| 1 | <template> |
| 2 | <div class="test"> |
| 3 | <h3>Ecosystem</h3> |
| 4 | <p>Test comp</p> |
| 5 | </div> |
| 6 | </template> |
| 7 | |
| 8 | <script> |
| 9 | export default { |
| 10 | name: "HelloWorld", |
| 11 | props: { |
| 12 | vname: String |
| 13 | }, |
| 14 | created: async function() { |
| 15 | //console.log("@variants/" + this.vname + ".js"); |
| 16 | // En fait "V" est une variable globale, donc juste "V = vModule.V;" |
| 17 | const vModule = await import("../variants/" + this.vname + ".js"); |
| 18 | const V = vModule.V; |
| 19 | var instance = new V(); |
| 20 | instance.show(); |
| 21 | //import("/src/variants/" + this.vname + ".js") |
| 22 | // .then((V) => { |
| 23 | // console.log(V); |
| 24 | // }); |
| 25 | //console.log(this.$variants); |
| 26 | |
| 27 | // TODO: components which need to access user.name and user.id should |
| 28 | // import a module with a function to get this from localStorage (or anonymous) |
| 29 | }, |
| 30 | methods: { |
| 31 | //... |
| 32 | }, |
| 33 | }; |
| 34 | </script> |
| 35 | |
| 36 | <!-- Add "scoped" attribute to limit CSS to this component only --> |
| 37 | <style scoped lang="scss"> |
| 38 | h3 { |
| 39 | margin: 40px 0 0; |
| 40 | } |
| 41 | ul { |
| 42 | list-style-type: none; |
| 43 | padding: 0; |
| 44 | } |
| 45 | li { |
| 46 | display: inline-block; |
| 47 | margin: 0 10px; |
| 48 | } |
| 49 | a { |
| 50 | color: #42b983; |
| 51 | } |
| 52 | </style> |