What is the best way to create a constant, that can be accessible from entire application in VueJs ?

前端 未结 4 601
难免孤独
难免孤独 2021-01-17 16:43

I can create a constant through a store in my vuejs application, but i don\'t think it is a good practice.what is other way to do the same?

4条回答
  •  被撕碎了的回忆
    2021-01-17 17:30

    try this instead

    //conts.js
    const test = "texte";
    
    export default test
    
    //component.vue
    import test from "./conts";
    
    
    
    export default {
      data: function(){
       return {
        example: test
      }
     }
    }
    

提交回复
热议问题