No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    [Solved] How to get data from App.vue in template

    Framework
    1
    2
    401
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • wahono
      wahono last edited by Shone

      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

      1 Reply Last reply Reply Quote 0
      • wahono
        wahono last edited by

        Upps! I just got the solution,
        this.$root.$options.globalData.serverHost

        1 Reply Last reply Reply Quote 0
        • First post
          Last post