We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
你好,我遇到问题,请求帮助~ 感谢 需求:有d2-crud table,需要要根据后端返回得数据来更新columns和data,第一次查询更新能得到正确得记过 问题:当第二返回数据得columns 和前一次不一样时,d2-crud 显示得数据就不正确了。 版本: "@d2-projects/d2-crud": "^2.1.1",
样例数据如下, res2 比res1多一个 column "key": "成缆_201934",
data () { return { table: [], columns: [], cur : 1, res1 :{ "rows": [ { "product": "普通", "成缆_201934": 1, "成缆_201935": 0, "成缆_201936": 1, }, ], "tablecolumns": [ { "key": "product", "title": "产品" }, { "children": [ { "key": "成缆_201935", "title": "201935" }, { "key": "成缆_201936", "title": "201936" } ], "title": "成缆" } ] }, res2 : { "rows": [ { "product": "普通", "成缆_201934": 1, "成缆_201935": 0, "成缆_201936": 1, }, ], "tablecolumns": [ { "key": "product", "title": "产品" }, { "children": [ { "key": "成缆_201934", "title": "201934" }, { "key": "成缆_201935", "title": "201935" }, { "key": "成缆_201936", "title": "201936" } ], "title": "成缆" } ] }, } },
更新table得代码
if (this.cur == 1){ this.columns = this.res1.tablecolumns this.table = this.res1.rows this.cur =2 } else{ this.columns = this.res2.tablecolumns this.table = this.res2.rows this.cur =1 } }
第二次数据更新后,
第一行数据显示 :普通 | 0 | 1 | 1 正确得显示 应该为 :普通 | 1 | 0 | 1
The text was updated successfully, but these errors were encountered:
把 d2-crud src 复制到项目调试时发现,编译时有错误,'' cannot be keyed. Place the key on real elements instead
template 改成span 后 ,发现数据就能正常显示了。
我是vue的初学者,不明白其中原理。但是表面上看上去可以了。
Sorry, something went wrong.
No branches or pull requests
你好,我遇到问题,请求帮助~ 感谢
需求:有d2-crud table,需要要根据后端返回得数据来更新columns和data,第一次查询更新能得到正确得记过
问题:当第二返回数据得columns 和前一次不一样时,d2-crud 显示得数据就不正确了。
版本: "@d2-projects/d2-crud": "^2.1.1",
data () {
return {
table: [],
columns: [],
cur : 1,
res1 :{
"rows": [
{
"product": "普通",
"成缆_201934": 1,
"成缆_201935": 0,
"成缆_201936": 1,
},
],
"tablecolumns": [
{
"key": "product",
"title": "产品"
},
{
"children": [
{
"key": "成缆_201935",
"title": "201935"
},
{
"key": "成缆_201936",
"title": "201936"
}
],
"title": "成缆"
}
]
},
res2 : {
"rows": [
{
"product": "普通",
"成缆_201934": 1,
"成缆_201935": 0,
"成缆_201936": 1,
},
],
"tablecolumns": [
{
"key": "product",
"title": "产品"
},
{
"children": [
{
"key": "成缆_201934",
"title": "201934"
},
{
"key": "成缆_201935",
"title": "201935"
},
{
"key": "成缆_201936",
"title": "201936"
}
],
"title": "成缆"
}
]
},
}
},
if (this.cur == 1){
this.columns = this.res1.tablecolumns
this.table = this.res1.rows
this.cur =2
}
else{
this.columns = this.res2.tablecolumns
this.table = this.res2.rows
this.cur =1
}
}
第一行数据显示 :普通 | 0 | 1 | 1
正确得显示 应该为 :普通 | 1 | 0 | 1
The text was updated successfully, but these errors were encountered: