[英]Accessing the Vue instance inside a component in Laravel Inertia
I am trying to parse a dynamic HTML with interpoltion inside them inside a Vue component in Inertia.我正在尝试在 Inertia 的 Vue 组件内解析动态 HTML 并在其中进行插值。 My code looks something like below:
我的代码如下所示:
<template>
<div v-if="parsed" v-html="parsed"></div>
</template>
...
export default {
data(): return {
html: null,
name: null,
parsed: null,
},
mounted() {
this.name = "John"; // I got this from the API
this.html = "<h1>Hi, {{this.name}}!</h1>";
this.parse();
},
methods: {
parse() {
this.parsed = Vue.compile(html);
}
}
}
The error I'm getting is:我得到的错误是:
[Vue warn]: Error in v-on handler: "ReferenceError: Vue is not defined"
[Vue 警告]:v-on 处理程序中的错误:“ReferenceError:Vue 未定义”
My question is, how do I access the underlying Vue object inside the component.我的问题是,如何访问组件内部的底层 Vue object。 Thanks!
谢谢!
Check the cdn or js file version you have given.查看你给的cdn或者js文件版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.