In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the relevant knowledge of how to use $set in vue, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this vue article on how to use $set. Let's take a look at it.
The code is as follows:
The click event has not been executed all the time. At first, I thought that the click event was not written correctly and kept looking for the reason, but then I suddenly thought that it might be the reason for the data out of sync, because the edit field is a field added by myself, as shown below:
Export default {name: 'strategic', data () {return {tableData: [{' pp_id': 4, 'brand_name':' 1414', 'project_name':' proud', 'description':' u will come back', 'publish_time':' 2018-07-23, 'is_used': 0}]}}, components: {}, computed: {} Created () {this.initTableData ()}, methods: {initTableData () {this.tableData.forEach (element = > {element.edit = false})}
After that, I directly added the edit field to the data and found that the data can be synchronized. The code is as follows:
Data () {return {tableData: [{'pp_id': 4,' brand_name': '1414,' project_name': '1414,' description': '7588888888,' publish_time': '2018-07-23,' is_used': 0, 'edit': false}]}
It turns out that when we use vue for development, when we generate the vue example and assign values to the data again, sometimes it cannot be automatically updated to the data. In this case, we need to solve this problem through $set. The solution code is as follows:
InitTableData () {this.tableData.forEach (element = > {this.$set (element, 'edit', false)})} this article on "how to use $set in vue" ends here. Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to use $set in vue". If you want to learn more, you are 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.