<template>
<div class="container">
<el-cascader
v-model="value"
:options="optionData"
:show-all-levels="false"
placeholder="正在选择数据中"
@change="handleDeptName"
></el-cascader>
</div>
</template>
<script>
export default {
data() {
return {
optionData: [],
value: [],
vals: []
};
},
created() {
},
mounted() {
const data = [
{
date: "2016-05-02",
id: "1",
name: "第一层数据1",
address: "1518",
children: [
{
date: "2016-05-02",
id: "11",
name: "第二层数据11",
address: "1518",
children: [
{
date: "2016-05-02",
id: "111",
name: "第三层数据111",
address: "1518",
children: [
{
date: "2016-05-02",
id: "1111",
name: "第四层数据1111",
address: "1518"
},
{
date: "2016-05-02",
id: "1111",
name: "第四层数据1112",
address: "1518"
}
]
},
{
date: "2016-05-02",
id: "112",
name: "第三层数据112",
address: "1518"
},
{
date:
多层数组对象添加属性值
最新推荐文章于 2023-03-27 01:59:01 发布
本文介绍如何在具有嵌套结构的多层数组对象中动态添加属性值。通过递归方法,可以遍历任意深度的数组,并在找到合适的位置插入新的属性,这对于处理复杂数据结构尤其有用。
摘要由CSDN通过智能技术生成