Can I access the variable named val1090 defined in validator.js from runesMetadata.js in nativescript vuejs?
This relates to metadata for raddataform in my case.
I encountered an error:
[Vue warn]: Error in data(): "ReferenceError: val1090 is not defined"
JS: found in
JS: ---> <Runes>
JS: <NavigationEntry>
runesMetadata.js
import validator from "./validator";
export default {
mixins: validator,
data () {
return {
makeRuneMetadata: {
'isReadOnly': false,
'commitMode': 'OnLostFocus',
'validationMode': 'Immediate',
'propertyAnnotations':
[
{
'name': 'r_makeRuneSpell',
'displayName': 'Make rune spell',
'index': 0,
'editor': 'Text',
},
{
'name': 'r_mpAbove',
'displayName': 'If MP above [%]',
'index': 1,
'editor': 'Number',
val1090, // <--------------------------
},
}
}
}
validator.js
const val1090 = {
'validators': [
{
'name': 'RangeValidator',
'params': {
'minimum': 10,
'maximum': 90,
'errorMessage': 'Value must be between 10-90.',
}
},
]
}
export default val1090
**EDITED BELOW **
Adding more objects to the validator like this:
onst val1090 = {
'name': 'RangeValidator',
'params': {
'minimum': 10,
'maximum': 90,
'errorMessage': 'Value must be between 10-90.'
}
};
const val115 = {
'name': 'RangeValidator',
'params': {
'minimum': 1,
'maximum': 15,
'errorMessage': 'Value must be between 1-15.'
}
};
export default{
val1090,
val115
}
In my component:
created() {
console.dir(val1090);
},
The output will be:
==== object dump start ====
JS: val1090: {
JS: "name": "RangeValidator",
JS: "params": {
JS: "minimum": 10,
JS: "maximum": 90,
JS: "errorMessage": "Value must be between 10-90."
JS: }
JS: }
JS: val115: {
JS: "name": "RangeValidator",
JS: "params": {
JS: "minimum": 1,
JS: "maximum": 15,
JS: "errorMessage": "Value must be between 1-15."
JS: }
JS: }
JS: ==== object dump end ====
How can I extract only the contents of the val1090 object? This is what I am looking for.
{
JS: "name": "RangeValidator",
JS: "params": {
JS: "minimum": 10,
JS: "maximum": 90,
JS: "errorMessage": "Value must be between 10-90."
JS: }
JS: }