Skip to content

Instantly share code, notes, and snippets.

@xydiva
Last active February 8, 2018 07:10
Show Gist options
  • Save xydiva/9875538a06a58a46120464677561871b to your computer and use it in GitHub Desktop.
Save xydiva/9875538a06a58a46120464677561871b to your computer and use it in GitHub Desktop.
打开后端请求返回的链接窗口

直接打开异步请求到的链接会被浏览器拦截。
可以使用如下解决方案:

async applyForAuth(row) {
    const win = window.open('about:blank', '_blank');
    const r = await getAuth(row.shopId);
    if (r.code === '8001') {
        win.location.href = r.data;
    }
    else {
        win.close();
        this.$message.error(r.msg);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment