【发布时间】:2018-09-12 04:39:44
【问题描述】:
在一个 Vue 组件中,我从一个单独的 js 文件中调用一个函数。 然后我需要在第一个函数完成后在我的组件中调用一个方法:
我的 .vue 组件:
import myFunction from '@/components/functions';
export default {
name: 'test',
components: {
myFunction,
},
created(){
if (....) {
myFunction.function1(myParam)
.then((response) => {
this.method2();
});
},
methods:{
method2(){
something;
},
}
};
我单独的functions.js文件:
export default {
function1(myParam) {
...
return true;
},
};
我尝试了几件事,例如我的代码中显示的最后一个,它给了我一个
.function1(...).then is not a function
我确信它没有那么复杂,但找不到正确的语法。 谢谢你的帮助
S.
【问题讨论】:
标签: javascript vue.js ecmascript-6