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

如何在JS中同步修改vue中的变量

image.png

index.js 里主动改变的数据怎么赋值给vue文件里面的变量???

除了使用vuex、sessionStorage及localStorage

还有没有别的好办法....


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

1 Answer

0 votes
by (71.8m points)

可以使用export,也可以使用export default。
引入的时候使用import { A, B} from index.js
如果是export default ,就是用import XXX from index.js


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

...