美文网首页
vue 修改数组方法

vue 修改数组方法

作者: Gino_Li | 来源:发表于2019-05-14 00:21 被阅读0次
1.splice()

与原生数组splice方法一样

2.$set方法
<script>
    export default {
        data(){
            return {
                arr:['game','movie','topic']
            }
        },
        methods:{
            change(){
                this.$set(this.arr,this.arr.indexOf('movie'),'music')
            }
        }
    }
</script>

相关文章

网友评论

      本文标题:vue 修改数组方法

      本文链接:https://www.haomeiwen.com/subject/eqzdaqtx.html