把AppletConfigurationAPI.GameServerList({ game_id: this.gameid, pageNot: true, }).then((res) => { this.gameswitchList = res.data.data; // this.getNewRoleSwitch() });改成promise
时间: 2023-06-06 16:07:50 浏览: 39
抱歉,我可以回答您如何将把AppletConfigurationAPI.GameServerList({ game_id: this.gameid, pageNot: true, }).then((res) => { this.gameswitchList = res.data.data; // this.getNewRoleSwitch() });改成promise,您需要将其封装在一个Promise对象中,代码如下所示:
```
new Promise((resolve, reject) => {
AppletConfigurationAPI.GameServerList({
game_id: this.gameid,
pageNot: true,
}).then((res) => {
resolve(res.data.data);
}).catch((error) => {
reject(error);
});
}).then((data) => {
this.gameswitchList = data;
// this.getNewRoleSwitch()
}).catch((error) => {
console.error(error);
});
```