如題,也就是如何在vue 的methods中方法互相調用!
分兩種情況,
1.被調用的方法不傳遞參數
這種情況下,直接寫 this.+方法名
2.被調用的方法需要傳參
這種情況下,需要this.$options.methods.+方法名。例如:
async creatMessage(){
let current = new Date();
this.submitTime= this.$options.methods.formatDate(current)
//這裏在creatmessage中調用了formate方法,formate需要傳入一個參數,因此要加上前面的部分
},