如何使用Quasar创建Vue.js组件?我收到一个错误消息,告诉我模板编译器不可用

时间:2019-10-25 07:38:19

标签: vue-component quasar-framework quasar

我想创建一个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,我将不胜感激。

0 个答案:

没有答案