Vue单页应用中的bug
Closed this issue · 3 comments
yuditxj commented
/**
- 初始化
- @param selector
- @param options
- @Private
*/
_init (selector, options) {
// version
this.version = 'VERSION'
// broadcast
this.broadcast = broadcast.broadcast
this.broadcast = broadcast.broadcast 在单页应用中会重复
单页应用中A跳转到B页面(在monted钩子里 new ZxEditor 一个对象),这时B返回A,A再跳转到B ,这样broadcast.broadcast并不是最初的对象,并没有初始化而是使用了之前的对象,导致select-picture会绑定多个事件,
this.zxEditor.on('select-picture', function () {
// 会多次触发这个事件,跳转多少次就会触发多少次
$inputFile.click();
})
为什么 this.broadcast = broadcast.broadcast 这里不直接用this.broadcast = {} 这样初始化呢?
capricorncd commented
export default {
beforeDestroy () {
this.zxEditor.destroy()
this.zxEditor = null
}
}
yuditxj commented
为什么 this.broadcast = broadcast.broadcast 这里不直接用this.broadcast = {} 这样初始化呢?
limnQQ commented
/**
- 初始化
- @param selector
- @param options
- @Private
*/
_init (selector, options) {
// version
this.version = 'VERSION'
// broadcast
this.broadcast = broadcast.broadcast
this.broadcast = broadcast.broadcast 在单页应用中会重复
单页应用中A跳转到B页面(在monted钩子里 new ZxEditor 一个对象),这时B返回A,A再跳转到B ,这样broadcast.broadcast并不是最初的对象,并没有初始化而是使用了之前的对象,导致select-picture会绑定多个事件,
this.zxEditor.on('select-picture', function () {
// 会多次触发这个事件,跳转多少次就会触发多少次
$inputFile.click();
})为什么 this.broadcast = broadcast.broadcast 这里不直接用this.broadcast = {} 这样初始化呢?
请教下 vue怎么引用zx-editor