Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.2k views
in Technique[技术] by (71.8m points)

vue页面如何将多个method抽离成单独的文件,然后像js使用全局变量/函数那样能操作引用页的data?

我有1个组件文件,包含了5000+行method,因为只有这个页使用这些方法,我想把这个文件的method按功能拆分为多个文件,引入后又能像在本页内一样使用data,操作页面,我尝试了mixins和extends属性,但是都达不到想要的效果


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

达不到是你的姿势不对,请仔细参考文档敲代码理解Mixins-vue.js


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...