How vue.js deletes dom nodes
This article mainly introduces vue.js how to delete dom nodes, the article is very detailed, has a certain reference value, interested friends must read it!
Vue.js delete dom node method: 1, v-for loop dom node to ensure that each li has a delete button, and bind delete event; 2, delete dom node, such as [this.datahistory.splice (this.$refs.li [index], 1)].
The operating environment of this paper: windows10 system, vue.js 2.9, thinkpad T480 computer.
Vue deletes the current dom node in two steps:
Step 1: v-for loop dom node, ensure that each li has a delete button, and bind the delete event
{{item}} delete
Step 2: delete the dom node
DeleteFn () {this.datahistory.splice (this.$refs.li [index], 1) / Click to call the delete method to delete the subscript item index in the datahistory array, and the 1 after the comma represents the deletion of the current 1 item} above is all the content of the article "how to delete dom nodes by vue.js". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!