1. 程式人生 > >解決非同步載入window.open 被攔截

解決非同步載入window.open 被攔截

                  on: {
                    click: () => {
                      var newTab=window.open('about:blank');
                      this.$http.post('/download/downfile',{title:params.row.title}).then(res => {
                        newTab.location = 'https://view.officeapps.live.com/op/view.aspx?src='+res;
                      })
                    }
                  }

在請求外部定義一個window物件

然後請求成功後重定義location