一、对象导出
1-1、导出
data.js
var a = 10;
var b = 20;
export default {
a,
b
}
1-2、导入
import data from './data'
...
mounted(){
console.log(data)
}
二、变量导出
2-1、导出
export
var a = 10;
var b = 20;
export {
a,
b
}
2-2、导入
import {a,b} from './data'
...
mounted(){
console.log(a)
console.log(b)
}