VueJS Axios发布请求-无法更新数据绑定

时间:2019-08-03 13:47:52

标签: vue.js vuejs2

我正在尝试使用以下方法更新我的VueJS页面。为了演示它在哪里工作以及在哪里不工作,我在下面添加了解释,但是我对如何绑定数据感到困惑。

Excel.Application  
Dim objExcel As New Excel.Application  
objExcel.ActiveWorkbook.SaveAs()

Sub SaveAs(Optional Filename As Object = Nothing, 
           Optional FileFormat As Object = Nothing, 
           Optional Password As Object = Nothing, 
           Optional WriteResPassword As Object = Nothing, 
           Optional ReadOnlyRecommended As Object = Nothing, 
           Optional CreateBackup As Object = Nothing, 
           Optional AccessMode As Excel.XlSaveAsAccessMode = xlNoChange,
           Optional ConflictResolution As Object = Nothing, 
           Optional AddToMru As Object = Nothing, 
           Optional TextCodepage As Object = Nothing, 
           Optional TextVisualLayout As Object = Nothing, 
           Optional Local As Object = Nothing)
 Member of Excel._Workbook

1 个答案:

答案 0 :(得分:2)

函数内部的

this.token不是Vuejs实例。您应该使用箭头功能

onSubmit(e) {
    e.preventDefault();
    this.token = "This works!"
    axios.post('http://mydomain/login', {
        username: this.form.email,
        password: this.form.password
    })
    .then((response) => {
        this.token = "This does not work!"
        console.log(response);
    })
    .catch(function (error) {
        console.log(error);
    });
}