Hello,
i need a value from $store.dispatch for refresh the item in the page when go to page from another page or when open app.
This is my code.
home.vue
<div class="demo-facebook-date">{{ total_info }}</div>
//...
data() {
return {
total_info: localStorage.total,
//...
methods: {
onPageInit() {
console.log('PAGE INIT');
var self = this;
this.$store.dispatch('tot_card').then(function (response) { self.total_info = localStorage.total ; }).catch(function (error) { console.log(error); })
//...
store.js
tot_card({dispatch}){
myDB.transaction(function(transaction) {
transaction.executeSql( 'SELECT is_sync FROM requests', [], function(tx, result) {
var tot = result.rows.length;
localStorage.setItem('total', tot);
},
function(error) {
alert("Error occurred while creating the table.");
});
}); //fine myDB
},
How i do ?
Thanks in advance