vue中怎么调用js方法
1 回答

吃鸡游戏
TA贡献1829条经验 获得超7个赞
定义Vue全局方法。
main.js中定义:Vue.prototype.myfunction = function() {/*你的自定义Vue方法*/}
子组件调用:this.myfunction();
定义Window对象全局方法。
在main.js中定义:window.myfunction = function() {/*你的自定义函数*/}
子组件调用:myfunction();
添加回答
举报
0/150
提交
取消