Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to render different buttons according to field results in web development

2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces how to render different buttons according to the field results in web development, which is very detailed and has a certain reference value. Friends who are interested must read it!

1. Update button data {{scope.row.is_monitored? based on a field of data. "remove Monitoring": "join Monitoring"}} View performance View status

If the value of scopy.row.is_monitored is "true", the type property of el-button is primary, otherwise it is success

If the value of scopy.row.is_monitored is "true", the value of el-button is to remove monitoring, otherwise the value is to join monitoring.

Optional js code

Const tmpText = row.is_monitored? "the host removes the monitoring queue, do you want to continue?": "the host joins the monitoring queue, do you want to continue?" This.$confirm (tmpText, 'prompt', {confirmButtonText:'OK', cancelButtonText: 'cancel', type: 'warning'}). Then () = > {axios.post (site_url + "host_view/", {"host_id": row.host_id "is_monitored": row.is_monitored}) .then (res = > {if (res.data.result) {if (row.is_monitored) {this.$message.success ('host removed monitoring queue successfully') } else {this.$message.warning ('host joined monitoring queue successfully');} this.getSearch ();} else {this.$message.error ('failed to update host monitoring status');}}, 'json') ). Catch (() = > {this.$message ({type: 'info', message:' update'});}); 2. Assign el-button to different type attributes to confirm completion depending on the field.

If the value of scopy.row.status is completed, the type property of el-button is empty, otherwise it is primary

If the value of scopy.row.status is "completed", the disabled property is bound for el-button, otherwise the disabled property is not bound

These are all the contents of the article "how to render different buttons according to field results in web development". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report