小编Mil*_*Way的帖子

如何在画布项中插入图像?

我正在为学校开展一个游戏项目,看起来像这样:游戏方面

 在游戏方面

我创建了这样的彩色多边形:

ship = can.create_polygon(410,650,450,600,490,650 , fill= 'red' , outline='black')

ennemies = can.create_rectangle(x-r, y-r, x+r, y+r, fill='green')
Run Code Online (Sandbox Code Playgroud)

所以现在我想用自己的形象填充它们.那可能吗 ?如何 ?

python tkinter tkinter-canvas

5
推荐指数
1
解决办法
3万
查看次数

如何组织嵌套的axios调用以使其更具可读性?

异步Axios调用让我有些失落。

我嵌套了Axios调用,这些调用工作得很好,但是我发现它不可读,并且我经常在这段代码中迷失了自己。

现在,我有类似的东西:


axios.get().then((response) => {
    this.pbmInfos = response.data;

    axios.get().then((response) => {
        this.contactInfos = response.data;

        axios.get().then((response) => {
            this.clientInfos = response.data).catch((error) => console.log(error));

    }).catch((error) => console.log(error));

    axios.get().then((response) => {
        this.lastViewDate = response.data).catch((error) =>  console.log(error));

}).catch((error) => console.log(error));


Run Code Online (Sandbox Code Playgroud)

(当然,为了清楚起见,我没有在get()中编写URL)

就目前而言,它看起来似乎并不太复杂,但这只是我打电话的一部分。

我试图在通用函数中将其分解,以便可以使用不同的参数来调用它,但是我没有成功,因为每个调用都需要将获取的数据分配给另一个变量,并且某些调用还需要在成功时调用另一个调用。

如果您有任何想法,我很乐意阅读。

asynchronous vue.js axios

0
推荐指数
1
解决办法
34
查看次数

标签 统计

asynchronous ×1

axios ×1

python ×1

tkinter ×1

tkinter-canvas ×1

vue.js ×1