Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. import Jason from './some.json';
  2. export defaults {
  3. data(){ return { someArr: Jason } } }
  4.  
  5. npm install json-loader --save
  6.  
  7. module: {
  8. loaders: [
  9. {
  10. test: /.json/,
  11. loader: 'json',
  12. }
  13. ],
  14. }
  15.  
  16. var yourJSONData= JSON.parse(Jason);
  17.  
  18. export default {
  19. "foo": "bar",
  20. ...
  21. }
  22.  
  23. import Conf from './static/app-conf.json';
  24. Vue.prototype.$appConfig = Conf;
  25.  
  26. <template>
  27. <div>{{someText}}</div>
  28. </template>
  29. <script>
  30. export default {
  31. name: 'Something',
  32. components: {},
  33. props: {},
  34. data: () => ({
  35. someText: Vue.prototype.$appConfig.someText,
  36. }),
  37. computed: {},
  38. methods: {}
  39. };
  40. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement