当前位置:网站首页>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>
边栏推荐
- What is the primordial universe
- Digital currency exchange -- digital currency exchange system development source code sharing
- The first techo day Tencent technology open day in 2022 will be held online on June 28
- An example of using dynamic datalist
- Zhangxiaobai's road to penetration (7) -sql injection detailed operation steps -union joint query injection
- Foreach method of array in JS
- ThinkPHP upload image compression size
- Full nanny tutorial of Market Research Competition (experience sharing)
- Slice() and slice() methods of arrays in JS
- Possible causes of wechat applet decryption failure
猜你喜欢

Swagger document generated by node project API in vscode

Installation and removal of MySQL under Windows

High performance + million level Excel data import and export

Go novice exploration road 2

(2) Pyqt5 tutorial -- > using qtdesigner to separate interface code

The first techo day Tencent technology open day in 2022 will be held online on June 28

ECSHOP video list_ ECSHOP uploading video, video classification, video list playing video function

The server reported an error 503 service unavailable:the system returned: (71) protocol error

Shell learning notes (latest update: 2022-02-18)

地理空间搜索:kd树的实现原理
随机推荐
Go novice exploration pause
PHP parsing QR code content
When MySQL queries fields in JSON format, it takes a property value of JSON data
How can we differ LEFT OUTER JOIN vs Left Join [duplicate]
Polling and long polling
(3) Pyqt5 tutorial -- > signal and slot preliminary test
New and old cluster migration of Minio data
ThinkPHP upload image compression size
laravel 9
yolov5训练使用的负样本图片
ECSHOP upload video_ ECSHOP video list, video classification, video related product guide
Qiantang Pingou source code -- Qiantang Pingou app system development source code sharing
Foreach method of array in JS
ECSHOP quickly purchases goods, simplifies the shopping process, and improves the user experience through one-step shopping
The push(), pop(), unshift(), shift() method in the JS array
Zhangxiaobai's way of penetration (III) -- detailed explanation of SQL injection vulnerability principle (SQL Server)
Idea2017 how to set not to automatically open a project at startup
Negative sample image used in yolov5 training
Yunfan mall -- Yunfan mall system development source code sharing
Windows下MySQL的安装和删除