-1
I am migrating my project to Vue-cli and the instance variables are not working:
main.js
Vue.$storage = Vue.prototype.$storage = new SecureLs({encodingType: 'rc4', isCompression: true, encryptionSecret: 'fasdfasdf'})
Vue.$defines = Vue.prototype.$defines = Defines
app.
computed: {
user_email: () => {
console.log(this.$defines) // undefined
console.log(this.$storage) // undefined
return ''
}
},
But the template works correctly:
{{ $storage.get('user') }}
{{ $defines }}
The same problem occurs with $store, $nextTick, etc..
EDIT: Even doing the installation via plugin, the problem continues:
<template>
<span class="caption">{{ $storage }}</span> <!-- Apresenta o valor na tela corretamente -->
</template>
<script>
export default {
name: 'App',
mounted: () => {
console.log(this.$storage) // Retorna UNDEFINED
}
}
</script>
Hello. Please post the solution downstairs, as an answer, and remove from the question. Now, very strange this...
– bfavaretto
Is in the documentation: Instance Lifecycle Hooks / Life Cycle of the Instance.
– NoobSaibot