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
949 views
in Technique[技术] by (71.8m points)

vuex 的stroe 文件里用 axios , 程序入口main.js 里也用axios ,那这两个axios 是独立的吗?

axios 在store文件里是用于获取数据,在main.js 是要往vue原型上挂,以便组件里获取数据。
两个文件各自引入axios,是否消耗更大的内存?
能否共用同一个axious?有啥建议方式。


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

1 Answer

0 votes
by (71.8m points)

是同一个,试试就知道了。
模块引入时,如果之前该模块已经加载过,则不会重新执行模块代码,直接取值即可。


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

...