how to pass yaml data to vue file

Solutions on MaxInterview for how to pass yaml data to vue file by the best coders in the world

showing results for - "how to pass yaml data to vue file"
Colm
07 Nov 2020
1// .vue file
2// must have yaml-loader installed as a dependency
3// place folowing block between <script></script>
4
5import AppConfig from "@/assets/config.yaml"; // gets data from yaml config
6
7export default {
8  name: "HelloWorld",
9  props: {
10    msg: String,
11  },
12  data() {
13    return {
14      // can use moustaches or v-bind to dynamically inject data in template
15      url: AppConfig.author["name"],
16      repo: AppConfig.repo,
17    };
18  },
19};