<template>
<Cascader :data="data" v-model="value2"></Cascader>
</template>
<script>
export default {
data () {
return {
value2: ["jiangsu", "suzhou", "zhuozhengyuan"],
data: [{
value: "beijing",
label: "",
children: [
{
value: "gugong",
label: ""
},
{
value: "tiantan",
label: ""
},
{
value: "wangfujing",
label: ""
}
]
}, {
value: "jiangsu",
label: "",
children: [
{
value: "nanjing",
label: "",
children: [
{
value: "fuzimiao",
label: "",
}
]
},
{
value: "suzhou",
label: "",
children: [
{
value: "zhuozhengyuan",
label: "",
},
{
value: "shizilin",
label: "",
}
]
}
],
}]
}
}
}
</script>
like the code value and label above, I can"t change every return item of my interface to value and label!
element-ui is fine. There is a props configuration. How to configure iviewui?
now the returned data format of the API is
{
"id": 1,
"name": "1",
"children":[
{
"id": 1,
"name": "1"
}
]
},
{
"id": 2,
"name": "2",
"children": [
{
"id": 5,
"name": "2"
}
]
},