1.关于DataV动态环图中发送请求拿到数据但是页面上没数据且数据不生效的问题
在data中定义了数据config,里面有data和定义的配置项但是发送请求拿到数据赋值了并且打印了也有数据但是页面就是不显示。
解决办法:将拿到的数据结构并再次赋值即可
async Getdatavlist() {
const lis = await this.Getdingeveryone()
this.config.data = lis
this.config.data.shift()
this.config = { ...this.config }
},
2.关于DataV中轮播表拿到数据要循环展示并且数据要实时更新
我做的是一个考勤方面的我拿到数据需要实时改变它的状态轮播表中提供了为updateRows的方法
doUpdate () {
this.$refs['scrollBoard'].updateRows(rows, index)
}
但是关于使用方面我不太明白,之后直接将数据给到updateRows发现能生效(updateRows是本来就定义好了无需我们自己定义)
<dv-scroll-board
ref="scrollBoard"
:config="config"
style="width: 99.9%; height: 99.9%"
/>
async Getdingclockinlist1() {
const list = await dingclockinlist({
departCenterId: this.departCenterId,
})
let arr = []
//双循环是为了获取我要的数据格式
for (let index = 0; index < list.data.length; index++) {
let array = []
array = list.data[index].map((v) => {
if (v == 'true') {
return (v = '<i class="iconfont icon-triangle-fill"></i>')
} else if (v == 'false') {
return (v = '')
} else {
return v
}
})
arr.push(array)
}
//现在arr格式为 [
//['行1列1', '行1列2', '行1列3'],
//],对应datav轮播表要的的数据格式
this.config.data = arr
this.$refs['scrollBoard'].updateRows(this.config.data)
},
将数据转化为轮播表要的格式即可