How to set a component non-reactive data in Vue 2?

前端 未结 5 1081
别跟我提以往
别跟我提以往 2020-12-03 10:05

I have a categories array, which is loaded once (in created hook) and then it is static all the time. I render this array values in a component template.

<         


        
5条回答
  •  佛祖请我去吃肉
    2020-12-03 10:41

    You can try this line of code. You can copy an object and remove the reactivity.

    var newObj = JSON.parse(JSON.stringify(obj));
    

提交回复
热议问题