still working

This commit is contained in:
vabene1111 2021-01-13 01:16:52 +01:00
parent ee130f9077
commit cd51d12618
2 changed files with 9 additions and 22 deletions

View File

@ -1,5 +1,4 @@
<template>
<div>
<component :is="compiled" :servings="servings" :code="code"></component>
</div>
@ -10,35 +9,23 @@ import Vue from 'vue'
import ScalableNumber from "@/components/ScalableNumber";
var res = Vue.compile('<div><span>{{servings}} Test <scalable-number v-bind:number="2" :factor="servings"></scalable-number></span></div>')
export default {
name: 'CompileComponent',
props: ['code', 'servings'],
data() {
return {
compiled: null,
test: '<div><p>Alle Zutaten vermischen und an einen <strong>warmen Ort</strong> stelllen <scalable-number v-bind:number="10.0000000000000000" v-bind:factor="servings"></scalable-number> g Anstellgut</p></div>'
}
},
components: {
ScalableNumber, // eslint-disable-line
},
mounted() {
setTimeout(() => {
this.compiled = Vue.component('button-counter', {
props: ['servings', 'code'],
components: {
ScalableNumber, // eslint-disable-line
},
data: function () {
return {
count: 0
}
},
template: `<div>${this.code}</div>`
})
}, 500)
this.compiled = Vue.component('compiled-component', {
props: ['servings', 'code'],
components: {
ScalableNumber, // eslint-disable-line
},
template: `
<div>${this.code}</div>`
})
}
}

View File

@ -1 +1 @@
{"status":"done","publicPath":"http://localhost:8080/","chunks":{"chunk-vendors":[{"name":"js/chunk-vendors.js","publicPath":"http://localhost:8080/js/chunk-vendors.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\chunk-vendors.js"}],"recipe_view":[{"name":"js/recipe_view.js","publicPath":"http://localhost:8080/js/recipe_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\recipe_view.js"},{"name":"recipe_view.5efb457965b10ba4c4a1.hot-update.js","publicPath":"http://localhost:8080/recipe_view.5efb457965b10ba4c4a1.hot-update.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\recipe_view.5efb457965b10ba4c4a1.hot-update.js"}]},"error":"ModuleError","message":"Module Error (from ./node_modules/vue-loader/lib/loaders/templateLoader.js):\n(Emitted value instead of an instance of Error) \n\n Errors compiling template:\n\n Component template requires a root element, rather than just text.\n\n 1 | \n | \n 2 | {{ calculateAmount(number) }}\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n 3 | \n"}
{"status":"done","publicPath":"http://localhost:8080/","chunks":{"chunk-vendors":[{"name":"js/chunk-vendors.js","publicPath":"http://localhost:8080/js/chunk-vendors.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\chunk-vendors.js"}],"recipe_view":[{"name":"js/recipe_view.js","publicPath":"http://localhost:8080/js/recipe_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\recipe_view.js"},{"name":"recipe_view.0cfcbd4a9e2e54391a69.hot-update.js","publicPath":"http://localhost:8080/recipe_view.0cfcbd4a9e2e54391a69.hot-update.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\recipe_view.0cfcbd4a9e2e54391a69.hot-update.js"}]},"error":"ModuleError","message":"Module Error (from ./node_modules/vue-loader/lib/loaders/templateLoader.js):\n(Emitted value instead of an instance of Error) \n\n Errors compiling template:\n\n Component template requires a root element, rather than just text.\n\n 1 | \n | \n 2 | {{ calculateAmount(number) }}\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n 3 | \n"}