转载地址:https://blog.csdn.net/weixin_43728978/article/details/104530261

1.首先你有一段拼接的html代码

let conten=`<button οnclick="come()">点我</button>`;

2.然后你需要在methods中有一个函数

methods:{
	come:function(){
		alert('你好,再见!')
	},
}

3.下一步就是连接起桥梁的关键点

created(){
	let _this=this;
	window.come=_this.come;
},

相关文章: