About the v-model binding value of el-select and el-cascader

1.el-select

(1) Single choice: v-model is bound to a string or a Number

data(){
    
    
	return {
    
    
		value: '1'
	}
}
<el-select v-model="value"></el-select>

(2) Multiple choice: v-model is bound to a one-dimensional array ['1', '2'], and the value of id is stored in the array

data(){
    
    
	return {
    
    
		value: ['1','2']
	}
}
<el-select v-model="value" multiple></el-select>

2.el-cascader

(1) Single choice: v-mode is bound to a one-dimensional array ['1', '2'], and the value of id is stored in the array

data(){
    
    
	return {
    
    
		value: ['1','2']
	}
}
<el-cascader v-model="value"></el-cascader>

(2) Multiple choice: v-model is bound to a two-dimensional array [[1,2,3], [1,2,4], [1,2,5]], and the array stores the ids from the parent to the last child

data(){
    
    
	return {
    
    
		value: [[1,2,3],[1,2,4],[1,2,5]]
	}
}
<el-cascader v-model="value" multiple></el-cascader>

Guess you like

Origin blog.csdn.net/weixin_42342065/article/details/127395255