轉載地址: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; },