資訊門戶網站怎么做個人免費推廣網站
因為我們在創(chuàng)建元素之前用了#div1"所有它會報錯,解決方案簡單粗暴咱們直接用
setTimeout(createEdit, 1)解決問題了
原理:vue的虛擬dom創(chuàng)建完成以后再調用真是dom就沒啥問題
function createEdit() {const editor = new E('#div1')editor.config.height = 200editor.create()
}export default {name: 'articleList',mounted() {},methods: {handleClick(row) {console.log(row)},createEditor() {this.dialogVisible = truecreateEdit()在這咱們直接調用 setTimeout(createEdit, 1)就會解決問題了},