当前位置:网站首页>select_ Render small phenomena
select_ Render small phenomena
2022-07-24 05:31:00 【Good [email protected]】
Catalog
Requirements describe
- select The data in the drop-down list is returned through the back-end interface ;
- Because of the large amount of data , So pull away 500 Data ( Incomplete quantity ), The rest of the data is obtained through fuzzy search ;
- When the drop-down box closes – Empty keywords , Get the drop-down list again ;
problem
- Get through fuzzy search 500 Data other than — choice ;
- When the drop-down box closes , Get the list again , The list does not contain the selected data , However, the selected element text can still be displayed instead of id;
Through the following cases
The drop-down box selects personnel by default 1, When you click change Button , The drop-down list will change ( The selected value remains unchanged );
key The value is element value
<template> <div style="margin-top:20px"> <el-select v-model="value" placeholder=" Please select "> <el-option v-for="item in dataList" :key="item.value" :label="item.label" :value="item.value"> </el-option> </el-select> <el-button @click='listChenge' size='mini'>change</el-button> </div> </template> <script> export default { data(){ return{ listObj:{ 1:[ { label:' personnel 1', value:111}, { label:' personnel 2', value:222}, { label:' personnel 3', value:333} ], 2:[ { label:' personnel 4', value:444}, { label:' personnel 5', value:555}, { label:' personnel 6', value:666} ], 3:[ { label:' personnel 7', value:777}, { label:' personnel 8', value:888}, { label:' personnel 9', value:999} ], }, index:1, dataList:[], value:111 } }, created(){ this.listChenge() }, methods:{ listChenge(){ this.index = this.index<=3 ? this.index : 1 this.dataList = this.listObj[this.index] this.index++ } } } </script>The process
[1] By default, select the candidate 1 , The drop-down list is listObj The first element list of ;
[2] Click on change Button , The drop-down list changes , however The selected value can still be echoed normally
key The value is index
<template> <div style="margin-top:20px"> <el-select v-model="value" placeholder=" Please select "> <el-option v-for="(item,index) in dataList" :key="index" :label="item.label" :value="item.value"> </el-option> </el-select> <el-button @click='listChenge' size='mini'>change</el-button> </div> </template>The process
[1] By default, select the candidate 1 , The drop-down list is listObj The first element list of ;
[2] Click on change Button , The drop-down list changes , however The selected value cannot echo normally , Echo value is value Instead of label
reason
- When dom update ,key The value is value when
- [1] Conduct path, adopt sameVnode Method will be judged as the same element ;
- [2]pathVnode Compare oldVnode==vnode, Direct reuse ;
- So no re rendering
- When dom update ,key The value is index when
- Conduct path, because key The value is different ,sameVnode Methods will be judged as different elements , Direct replacement ;
- Rendering reality dom updated
版权声明
本文为[Good [email protected]@@]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/205/202207240515391565.html
边栏推荐
猜你喜欢

canvas - 圆形

What is the function of key

模板数据的二次加工

赶紧进来!!轻松掌握C语言“顺序”、“分支”、“循环”三大结构

select_渲染小现象

Install pytoch+anaconda+cuda+cudnn

Pure white tutorial using Druid database connection pool in idea

C2 random generation function seed, numpy. Random. Seed(), TF. Random. Set_ Seed Learning + reprint and sorting

special effects - 鼠标移动,出现星星拖尾

一文node安装下载和配置
随机推荐
新建 umi 项目,Error: Rendered more hooks 或者 Rendered fewer hooks
special effects - 鼠标点击,出现随机设置的文字
What is the function of key
C语言从入门到入土——数组
数据类型概括
栈与队列的互相实现(C)
C语言入门篇 概述
再次聊聊浏览器缓存
gdb调试core/dump
输入10个人的名字,按从大到小排序输出
还原ui设计稿
按钮 渐变
canvas - Bezier 贝塞尔曲线
浏览器的本地存储
5.模板缓存,绘制一个正方形只能在三角形内移动
JS - 计算直角三角形的边长及角度
新语法01_Es6新语法
special effects - 鼠标点击,出现随机颜色的爱心
OPENGL在屏幕上绘制2个点,右边一个蓝色的点,采用反走样技术,左边一个红色的点,不采用反走样技术。比较两个点的区别。
Promise_async与await

