如题,也就是如何在vue 的methods中方法互相调用!
分两种情况,
1.被调用的方法不传递参数
这种情况下,直接写 this.+方法名
2.被调用的方法需要传参
这种情况下,需要this.$options.methods.+方法名。例如:
async creatMessage(){
let current = new Date();
this.submitTime= this.$options.methods.formatDate(current)
//这里在creatmessage中调用了formate方法,formate需要传入一个参数,因此要加上前面的部分
},