您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

vue.js数组更新实例分享

2025/5/22 15:45:09发布17次查看
本文主要和大家分享vue.js数组更新实例,希望能帮助到大家。
改变原始数组
push()
pop()
shift()
unshift()
splice()
sort()
reverse()
不改变原数组
filter()
contat()
slice()
实例:
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<b.name.length }) } }
mounted(){ this.books.push({ //push数组方法,视图直接改变 name:'《css3实战》', author:'huiyh' }); this.books=this.books.concat([{ //concat数组方法,需更新原数组 name:'《html5实战》', author:'lala' }]) }
以上就是vue.js数组更新实例分享的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product