Which is valid format of :only-countries using VuePhoneNumberInput? - vuejs2

Which is valid format of :only-countries using VuePhoneNumberInput ?
I try :
<VuePhoneNumberInput
v-model="profileRow.phone"
#update="onUpdate"
:only-countries="[ 'es', 'en', 'us' ]"
/>
and got console error :
[Vue warn]: Error in nextTick: "Error: Key is undefined on item (keyField is 'null')"
found in
---> <RecycleScroller>
<CountrySelector>
<MazPhoneNumberInput>
Looking into source files I tried:
<VuePhoneNumberInput
v-model="profileRow.phone"
#update="onUpdate"
:only-countries="[ ['Afghanistan', 'af', '93'], ['Albania', 'al', '355'] ]"
/>
but got the same error.
"vue": "^2.6.11",
"vue-phone-number-input": "^1.1.9",
Thanks!

Instead of using lower case ISO2 country codes, you need to use all caps code like:
:only-countries="[ 'ES', 'US', 'AF', 'AL' ]"
Also, please verify for which country en is the code, If you meant to use the country code for "Great Britain", then you will need to use GB instead.

Related

Vue js [Vue warn]: Duplicate keys detected:

Hello I know what is the problem but I don't know how to solve it. Please help.
I am generating input fields and text area fields, so I have 2 v-fors(I will and third one too)
<div v-for="(textarea, textareaId) in blog.textareas" :key="textareaId">
<div v-for="(sectionTitle, sectionTId) in blog.sectionTitles" :key="sectionTId">
blog:{
blogTitle: '',
images: [
{
imagesId: 0,//this was called id
name: ''
}
],
sectionTitles:[
{
sectionTId: 0,//this was called id
title: ''
},
],
textareas: [
{
textareaId:0, //this was called id
text: ''
},
]
},
I have tried to change ids to not be all three 0 but I keep getting a warning evert time I enter the same number to :key="id"
Duplicate keys detected: '1'
Duplicate keys detected: '2'
and so on.
:key="'textarea_'+textareaId" and for sectionTitles :key="'section_'+sectionTId"

Is clojure.spec check generating bad input?

Using clojure.spec (org.clojure/clojurescript {:mvn/version "1.10.520"}), I have a function spec that specifies a map for its input.
gen/generate and gen/sample work fine. But calling cljs.spec.test.alpha/check errors with input that should be a map, but is passed a collection (Error: More than one element found in structure). Ie, it looks like the spec system is generating bad input.
Is this a bug with spec?
bar spec
(s/def ::check-run
(s/keys
:req-un
[::action
::check_run
::installation
::organization
::repository
::sender]))
foo.cljs
(s/def ::payload :bar/check-run)
(s/def ::check-run-started (s/keys :req-un [::payload]))
(s/fdef check-run->cijob-created
:args (s/cat :arg ::check-run-started))
(defn check-run->cijob-created [arg])
While the function spec only declares A, the spec system is generating B.
;; A
{:payload {:action "", :check_run {:html_url "", }}, ...}
;; B
[({:payload {:action "", :check_run {:html_url "", }}, ...}})]
workbench
(cljs.spec.test.alpha/check
`foo/check-run->cijob-created
{:clojure.spec.test.check/opts {:num-tests 10}})
[{:spec #object[cljs.spec.alpha.t_cljs$spec$alpha50916],
:clojure.spec.test.check/ret
{:shrunk
{:total-nodes-visited 313, :depth 148, :pass? false, :result #object[Error Error: More than one element found in structure: 0], :result-data #:clojure.test.check.properties{:error #object[Error Error: More than one element found in structure: 0]}, :time-shrinking-ms 11299,
:smallest
[({:payload {:action "", :check_run {:html_url "", }}, ...}})]},
:sym foo/check-run->cijob-created,
:failure #object[Error Error: More than one element found in structure: 0]}]
[1]: https://clojure.org/about/spec
Ok, figured this one out. It was failing due to my use of a specter macro (with navigators). I’m not sure how. But somehow this messes up test.check generators. I’m assuming it’s some kind of strange interplay that’s unworkable with Clojurescript’s macro system.
Anyways, migrating to a simpler get-in fixed the problem.

MapboxGL.SymbolLayer filter expression to check if id in array

I am trying to do the following with react-native-mapbox-gl
<MapboxGL.SymbolLayer
id="controlPointIcon"
filter={['all', ['in', 'id', this.state.nextPossible], ['==', 'type', 'alt']]}
style={mapStyle.iconControlPoint}
/>
The filter is supposed the match only if the given GeoJSON feature has its property id included in the array this.state.nextPossible and if the property type matches 'alt'.
I am clearly doing something wrong, the error I am getting says:
Invalide predicate: "id" ... NSInvalidArgumentException
reason [__NSCFNumber isEqualTOString:]: unrecognized selector sent to instance ...
Any idea how to solve this with mapbox filter expressions?
See https://github.com/react-native-mapbox-gl/maps/issues/70#issuecomment-499775185 in is a legacy filter syntax and not supported. Please use match instead.
<MapboxGL.SymbolLayer
id="controlPointIcon"
filter={
['all',
['match',
'id', this.state.nextPossible, true,
false
],
['==', 'type', 'alt']
]}
style={mapStyle.iconControlPoint}
/>

Vue.js short and clean syntax for data

I started using vue.js and i would like to know if there is any best way (clean) to declare my data variables:
for example i have :
profileInfos: {
name:null,
email: null,
mobile: null
},
when i do :
profileInfos: {name, email, mobile},
i get an error message : email not defined
can i declare profileInfos without the keys name, email, mobile and use v-text in my html tags ?
You can simply do:
declare
profileInfos: {}
then you can straightforwardly set undeclared property up to 1 level of the object like:
this.profileInfos.name = 'my Name'

escape backslashes in dataweave

I have a string array in properties file, and I want to read its value in dataweave in JSON format.
The array in properties file is-
Countries = ["USA","England","Australia"]
in dataweave, I am using this-
%output application/json
---
{
countries: p('Countries')
}
Output I am getting is-
"countries": "[\"USA\",\"England\",\"Australia\"]",
Output I want is-
"countries": [
"USA",
"England",
"Australia"
]
I have tried with replace but no luck.
I also tried countries map $ as String after changing country array to Countries = ['USA','England','Australia'] but it says Invalid input 'S', expected :type or enclosedExpr
How to achieve this?
The problem is that properties file values are strings and not arrays so your expression is not interpreted. But don't worry you can use the read function
read(p('Countries'), "application/json"))