Picker报错 Cannot assign to read o
2018-12-25 本文已影响0人
鹅鹅鹅_
antd-mobile picker报错
Cannot assign to read only property '0' of string
原因:数据源value字段需要int类型
const vms = [{
value: 0,
label: "全部",
}, {
value: 1,
label: "充值",
}, {
value: 2,
label: "提现",
},{
value: 3,
label: "收益",
}, {
value: 4,
label: "支出",
}, {
value: 5,
label: "跟投",
}, {
value: 6,
label: "领投",
}, {
value: 7,
label: "服务费",
},{
value: 8,
label: "提前返还",
}]
这种情况下就需要各种map进行转换了
const v2label = {0: "全部", 1: "充值", 2: "提现", 3: "收益", 4: "支出", 5: "跟投", 6: "领投", 7: "服务费", 8: "提前返还"}
const type2v = {"all": 0, "recharge": 1, "withdraw": 2, "gain": 3, "buy": 4, "followed": 5, "follower": 6, "buy_fee": 7, "early_return": 8}
const v2type = {0: "all", 1: "recharge", 2: "withdraw", 3: "gain", 4: "buy", 5: "followed", 6: "follower", 7: "buy_fee", 8: "early_return"}