vue.js array update example sharing

小云云
Release: 2018-03-19 16:02:13
Original
1430 people have browsed it

This article mainly shares vue.js array update examples with you, hoping to help everyone.

Change the original array

push()

pop()

shift()

unshift()

splice()

sort()

reverse()

Does not change the original array

filter()

contat()

slice()

Example:

computed:{ filterBooks(){ return this.books.filter(function(book){ return book.name.match(/javascript/) }) }, sortBooks(){ return this.lists.sort(function (a,b) { return a.name.length
        
Copy after login
mounted(){ this.books.push({ //push数组方法,视图直接改变 name:'《css3实战》', author:'huiyh' }); this.books=this.books.concat([{ //concat数组方法,需更新原数组 name:'《html5实战》', author:'lala' }]) }
Copy after login

The above is the detailed content of vue.js array update example sharing. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!