Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

动态引入及动画删除 #23

Closed
erguotou520 opened this issue Dec 7, 2017 · 2 comments
Closed

动态引入及动画删除 #23

erguotou520 opened this issue Dec 7, 2017 · 2 comments

Comments

@erguotou520
Copy link

erguotou520 commented Dec 7, 2017

提供一个基于vue的实现方案:

data () {
  return { script: null }
},
created () {
    const script = document.createElement('script')
    script.src = '//cdn.bootcss.com/canvas-nest.js/1.0.1/canvas-nest.min.js'
    script.type = 'text/javascript'
    // script.setAttribute('zIndex', 0)
    document.body.appendChild(script)
    this.script = script
  },
  beforeDestroy () {
    const l = document.getElementsByTagName('script')
    const canvasNest = document.getElementById('c_n' + l.length)
    if (canvasNest) {
      canvasNest.remove()
    }
    if (this.script) {
      this.script.remove()
    }
  }

其它mvvm系统实现方案类似

@hustcc
Copy link
Owner

hustcc commented Jun 23, 2018

感谢提供方案,v2.0.1 已经可以做到了!而且这个方法可能在事件上处理不太好!

@hustcc hustcc closed this as completed Jun 23, 2018
@erguotou520
Copy link
Author

内置支持当然好了,还可以remove掉鼠标事件

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants