需求
要在vue的一个模块中引入远程的js,并在js加载完成之后处理一些逻辑
参考
各种搜索之后发现并没有我想要的那种解决方案,然后找了几个博客资料。感谢博主们的分享
- http://blog.csdn.net/sinat_17775997/article/details/55798611 最相似的一篇博客
- render函数两篇博客
- vue父子组件传值
创建组件
使用render函数创建一个组件,使用createElement添加dom节点。
components: { 'remote-js': { render (createElement) { var self = this return createElement('script', { attrs: { type: 'text/javascript', src: this.src }, on: { load: function