[Solved] How to get data from App.vue in template
-
How to get variable ‘serverHost’ from App instance in template?
<template> <div id="q-app"> <router-view /> </div> </template> <script> import Vue from 'vue' import store from './store' import { LocalStorage } from 'quasar' Vue.filter('formatPrice', function (value, fixed = 0) { let val = (value / 1).toFixed(fixed).replace('.', ',') return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.') }) let serverHost = LocalStorage.get.item('serverhost') export default { name: 'App', store: store, serverHost: serverHost } </script> <style> </style>
Thanks
-
Upps! I just got the solution,
this.$root.$options.globalData.serverHost