我想创建一个Vue.js组件(使用Quasar ),其中包含从(不同的)Web服务器加载的模板(精确地是一个包含HTML代码段的字符串)。
我注册了以下组件:
... MyPage.vue ...
<template>
<my-component></my-component>
</template>
<script>
export default {
components: {
'MyComponent': () =>
fetch('http://acme.com/template')
.then(response => ({
template: response.data,
data () {
return {}
}
}))
}
}
</script>
但是使用该组件会导致以下错误:
You are using the runtime-only build of Vue where the template compiler is not available.
Either pre-compile the templates into render functions, or use the compiler-included build.
主要问题是,使用Quasar与创建“纯” Vue.js应用程序有点不同。这意味着,到目前为止,我阅读的所有解决方案都无法在“纯” Vue.js应用程序中解决此问题,在我的Quasar 应用程序中尚未解决该问题。因此,如果提出的解决方案仅涉及Quasar,我将不胜感激。