//vue html渲染标签,绑定test方法
<div v-html="data" @click="test"></div>

//html渲染内容
//<button type="button" class="btn">按钮</button>

methods:{
    //隐藏内容事件
    test(event) {
        // console.log(event)
        if (event.target.className === 'btn') {
            //处理逻辑
            alert('yes');
        }
    }
}

标签: html, vue

添加新评论