1,变量引用
外部js:
var s = "变量数据";
export default{
customData:function () {
return s;
}
}
vue实例文件
import SM from "../../static/js/networkRequest"
export default {
data () {
return{
newData:SM.customData()
}
}
}
2,方法调用
外部js:
function test(){
console.log("tttttttttttttttttttt::::")
}
export {
test
}
vue实例文件
import { test} from "../../static/js/mathUtils"
created(){
this.test2();
},
methods: {
test2(){
test()
}
}
3,变量引用
外部js:
const S="dd"
export {
accMul,
S
}
vue实例文件
import { accMul,S } from "../../static/js/mathUtils"
export default {
data () {
return{
str:S
}
},
created(){
console.log("=====================::::" +accMul(2,4))
console.log("=====================::::" +this.str)
}
}
网友评论