1. Effect Function: Use the data retrieved from the interface to display the optional items and start with the default option values. 2. Main code<el-cascader ref="cascaderAddr" :options="rangeArr" :props="optionProps" v-model="plable" @change="handleChange3" style="width: 100%;"></el-cascader> explain: (1) The data source does not conform to the official data source and needs to be redirected But the data source returned by our interface is as follows: So we need to re-point to the value, label and children values (hence: props="optionProps"); (2) expandTrigger: The expansion method of the secondary menu is click/hover. The default is click. (3) checkStrictly: Whether to strictly abide by the principle that parent and child nodes are not related to each other export default { data() { // Delivery location selection source rangeArr: [], optionProps: { value: 'sguid', label: 'address', children: 'childs', checkStrictly: true, expandTrigger: 'hover' }, plable: [], //delivery selection value}, mounted: function() { //Delivery location this.$axios .get('url') .then(response => { this.rangeArr = response.data.obj; console.log('Delivery can choose source aaaa', this.rangeArr); }) .catch(function(error) { // Request failure processing console.log(error); }); //Get the initial value this.$axios.get("url") .then((response) => { if (response.data.status == 200){ this.plable=response.data.obj.ranges_sguid;//Default selected value } }) .catch(function (error) { // Request failure processing console.log(error); }); }, methods: { handleChange3(value) { console.log('select id value',value); console.log('Select label value',this.plable); var thsAreaCode = this.$refs.cascaderAddr.getCheckedNodes()[0].pathLabels;; //Note 2: Get label value console.log('lable',thsAreaCode) // Note 3: The final result is a one-dimensional array object var len=value.length-1; this.form.ranges_sguid=value[len];//This is the final modified selected data value to be submitted console.log('guid',this.form.ranges_sguid); this.$refs.cascaderAddr.toggleDropDownVisible(); // After selecting, collapse the drop-down interface } } This is the end of this article about the practice of el-cascader cascade selector in elementui. For more relevant element el-cascader cascade selector content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
This article shares the specific code of js to re...
EXPLAIN shows how MySQL uses indexes to process s...
This article shares the specific code of node+soc...
Installation suggestion : Try not to use .exe for...
Table of contents Preface Enumerable properties I...
<br />Choose the most practical one to talk ...
There are three types of MySQL stored procedure p...
Table of contents 1. Affairs: Four major characte...
We all know that the performance of applications ...
Table of contents 1. Preparation 2. MySQL encrypt...
Because the data binding mechanism of Vue and oth...
Download mysql-5.7.19-winx64 from the official we...
1. What is mycat A completely open source large d...
1. The relationship between fonts and character d...
The CSS3 category menu effects are as follows: HT...