cascader级联选择器

 		  <!-- options 用来指定数据源 -->
          <!-- props 用来指定配置对象 -->
          <!-- v-model选中项绑定值 -->
          <el-cascader
            :options="parentCateList"
            :props="cascaderProps"
            v-model="selectedKeys"
            @change="parentCateChanged"
            clearable
            change-on-select
          >
          </el-cascader>
	// 选中的父级分类的Id数组
      selectedKeys: []

	// 指定级联选择器的配置对象
      cascaderProps: {
    
    
        value: 'id',
        label: 'name',
        children: 'children',
        expandTrigger: 'hover'
      },

	 // 选择项发生变化触发这个函数
    parentCateChanged(val) {
    
    
      console.log(this.selectedKeys)
  	  console.log(val)
  
      }

猜你喜欢

转载自blog.csdn.net/weixin_46852620/article/details/113659679