<body>
<div id="app">
<button @click="add">添加</button>
<div id="side"></div>
</div>
<script>
new Vue({
el: '#app',
methods:{
add(){
var div = document.getElementById('side');
div.innerHTML='<button @click="show"></button>'
},
show(){
alert('123')
}
}
})
</script>
</body>
如上面的代码?
其中由 js 插进去的 vue 有办法解析吗?
因为有用到插件的时候,插件利用 js 把 html 代码插入到了页面