| 1 | <!--<template :src="require(`@/rules/${vname}/${st.lang}.pug`)"> |
| 2 | </template> |
| 3 | --> |
| 4 | |
| 5 | <template lang="pug"> |
| 6 | .section-content(v-html="content") |
| 7 | </template> |
| 8 | |
| 9 | <script> |
| 10 | import Diagrammer from "@/components/Diagrammer"; |
| 11 | import { store } from "@/store"; |
| 12 | export default { |
| 13 | name: "my-variant-rules", |
| 14 | components: { |
| 15 | Diagrammer, |
| 16 | }, |
| 17 | props: ["vname"], |
| 18 | data: function() { |
| 19 | return { |
| 20 | st: store.state, |
| 21 | content: "", |
| 22 | }; |
| 23 | }, |
| 24 | watch: { |
| 25 | vname: function() { |
| 26 | this.loadVariantFile(); |
| 27 | }, |
| 28 | }, |
| 29 | methods: { |
| 30 | loadVariantFile: function() { |
| 31 | if (this.vname != "_unknown") |
| 32 | { |
| 33 | // TODO (to understand): no loader required here ? Pug preset ? |
| 34 | const content = require("raw-loader!@/rules/" + this.vname + "/" + this.st.lang + ".pug"); |
| 35 | console.log(content); |
| 36 | this.content = content; |
| 37 | } |
| 38 | }, |
| 39 | }, |
| 40 | created: function() { |
| 41 | this.loadVariantFile(); |
| 42 | }, |
| 43 | }; |
| 44 | </script> |
| 45 | |
| 46 | <!-- |
| 47 | TODO: template + script dans rules/Alice/en.pug (-> .vue), puis dynamic import ici ?! |
| 48 | --> |