vue拼接html中onclick的触发方式,vue中的onclick,vue触发onclick,vue拼接html

转载地址: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;
},
posted @ 2020-08-19 20:41  山兮木  阅读(4468)  评论(0编辑  收藏  举报
/* 看板娘 */