当前位置:网站首页>Wechat applet cloud database value assignment to array error
Wechat applet cloud database value assignment to array error
2022-04-23 03:35:00 【CSDN Q & A】
The code is as follows :
Page({
data: {
url:[], // Array
},
previewImage:function(event){
wx.cloud.database().collection("imgs").where({op:'1'}).get({
success:function(res){
for(var i=0;i<res.data.length;i++){
var newar = {
site:JSON.stringify(res.data[i].url)
};
this.data.url = this.data.url.concat(newar);// Array assignment
this.setData({
url:this.data.url
});
}
}
}),
wx.previewImage({
//urls: ["cloud://huqq12-5gd07ykk20bc150b.6875-huqq12-5gd07ykk20bc150b-1311173720/2.png"] // Contents of the desired array
urls: [url]
})
},
})
Report errors :
database
Take the answer :
Write it like this... Try it
previewImage:function(event){ var _this = this; wx.cloud.database().collection("imgs").where({op:'1'}).get({ success:function(res){ for(var i=0;i<res.data.length;i++){ var newar = { site:JSON.stringify(res.data[i].url) }; let tempData = _this.data.url.concat(newar);// Array assignment _this.setData({ url:tempData }); } } }), wx.previewImage({ //urls: ["cloud://huqq12-5gd07ykk20bc150b.6875-huqq12-5gd07ykk20bc150b-1311173720/2.png"] // Contents of the desired array urls: [url] }) }
版权声明
本文为[CSDN Q & A]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204151501087501.html
边栏推荐
- socket編程 send()與 recv()函數詳解
- Supersocket is Use in net5 - concept
- Commonly used classes
- SQL learning record
- Laboratory safety examination
- Using swagger in. Net5
- 7-1 introduction to finance
- Initial experience of talent plan learning camp: communication + adhering to the only way to learn open source collaborative courses
- L3-011 direct attack Huanglong (30 points)
- POI create and export Excel based on data
猜你喜欢
抽象类、接口、常用关键字
Unity games and related interview questions
PyMOL usage
Explanation keyword of MySQL
L3-011 direct attack Huanglong (30 points)
Instructions for fastmock
常用的辅助类
Unity knowledge points (ugui)
Wechat applet canvas draws a simple asymptotic color of the dashboard
2022 group programming ladder simulation l2-1 blind box packaging line (25 points)
随机推荐
Leetcode 617 merge binary tree
Design and implementation of redis (4): what is the event driver of redis
JS, bind the event for a label with input, and then bind the stand-alone event in the parent element. The event is executed twice and solved
Unity knowledge points (ugui 2)
Problem C: Hanoi Tower III
C-11 problem I: find balloon
2022 团体程序设计天梯赛 模拟赛 L1-7 矩阵列平移 (20 分)
Docker pulls MySQL and connects
SQL topic exercise summary
Supersocket is Used in net5 - command
There is no index in the database table. When inserting data, SQL statements are used to prevent repeated addition (Reprint)
Notes sur l'apprentissage profond (Ⅱ) - - Principe et mise en oeuvre de la fonction d'activation
Software testing process
you need to be root to perform this command
Seekbar custom style details
Create virtual machine
WinForm allows the form form to switch between the front and active states
Database - MySQL -- Navicat import SQL error 1067 - invalid default value for 'paydate‘
Problem B: small challenge
7-2 Tushare