当前位置:网站首页>The drop-down box renders numbers instead of the corresponding text. How to deal with it
The drop-down box renders numbers instead of the corresponding text. How to deal with it
2022-06-25 12:42:00 【fortunate_ leixin】
The front end uses ruoyi , The dictionary stores string Type of , When the field type we set is inconsistent with the dictionary value type, it cannot be rendered correctly . Two solutions :1 Background processing : Change the field type to in the background string, The front end normally traverses the value ;2, Front-end processing : Backstage doesn't change , Is still string type , When traversing the front end, use Number Convert type to .
The page display :
This should show 1 The resignation of the employee , That is, voluntary resignation , But because the type is inconsistent with the value of the dictionary , As a result, it is not rendered correctly
terms of settlement :
1: Modify the entity class field in the background as String, Turned out to be Integer type
The front end can correctly render the corresponding Chinese characters 
When the drop-down box traverses the value , Direct value
<el-select v-model="quitForm.departureType" placeholder=" Please select " @change="choose($event)">
<!--<el-option label=" Take the initiative to leave " value="1"></el-option>
<el-option label=" Passive resignation " value="2"></el-option>-->
<el-option
v-for="dict in quit"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
2: There is no need to modify the type of background field , Front end use Number Type cast :

Use Number Transformation types
<el-select v-model="quitForm.departureType" placeholder=" Please select " @change="choose($event)">
<!--<el-option label=" Take the initiative to leave " value="1"></el-option>
<el-option label=" Passive resignation " value="2"></el-option>-->
<el-option
v-for="dict in quit"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="Number(dict.dictValue)"
/>
</el-select>
边栏推荐
- JS function exercises
- Go novice exploration road 1
- Disconnected: No supported authentication methods available (server sent: )
- Guess Tongyuan B
- (5) Pyqt5 ---- another method of connecting signals and slots
- Wechat forbids sharing
- Wait for the end of the network request in the uniapp Onshow method before executing the subsequent code content
- GNSS receiver technology and application review
- 2022 meisai e topic ideas sharing + translation
- mysql FIND_ IN_ Set function
猜你喜欢

Penetration tool environment - installing sqli labs in centos7 environment

ECSHOP upload video_ ECSHOP video list, video classification, video related product guide

ECSHOP quickly purchases goods, simplifies the shopping process, and improves the user experience through one-step shopping

高性能负载均衡架构如何实现?
![Maximum number [abstract rules for abstract sorting]](/img/47/f6bafacc95f487854a3e304325f3f0.png)
Maximum number [abstract rules for abstract sorting]

Idea2017 how to set not to automatically open a project at startup

Total number of MySQL statistics, used and unused

(6) Pyqt5--- > window jump (registration login function)

High performance + million level Excel data import and export

一篇文章讲清楚MySQL的聚簇/联合/覆盖索引、回表、索引下推
随机推荐
Write regular isosceles triangle and inverse isosceles triangle with for loop in JS
A commonly used statistical modeling method -- difference analysis
Select randomly by weight [prefix and + dichotomy + random target]
按权重随机选择[前缀和+二分+随机target]
Ubuntu uninstalling PHP
Penetration tool environment -- use of cknife Chinese kitchen knife
JS array de duplication
Initialize the project using the express framework
ThinkPHP upload image compression size
K8s, docker compose install MySQL 8.0.18
Swagger document generated by node project API in vscode
Mind mapping video
MySQL and excel tables importing database data (Excel for MySQL)
PHP parsing QR code content
Digital currency exchange -- digital currency exchange system development source code sharing
el-select clear 清空内容时触发事件
2022 meisai D topic ideas sharing + translation
PHP multidimensional array sorting
flutter 收到推送后自动消失问题
Zhangxiaobai's way of penetration (V) -- detailed explanation of upload vulnerability and parsing vulnerability