共1个回答
EC
游客ecqXMk

在这个错误之前,应该会有一个警告:



[Vue warn]: 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.

你需要修改nuxt的配置,添加:

 extend(config, ctx) {
      config.resolve.alias["vue"] = "vue/dist/vue.common";
    },

还需要引用CDN中的字体文件夹,或者从node_modules中的mathlive/dist/fonts目录复制字体文件夹。要引用CDN字体文件夹,请指定fontDirectory配置选项,如下所示:

   <mathlive-mathfield
        id="mf"
        ref="mathfield"
        v-model="formula"
        :config="{smartFence:false, fontsDirectory:'https://unpkg.com/mathlive/dist/fonts'}"
        :on-keystroke="displayKeystroke"
        @focus="ping"
      >