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

前端 未结 5 1084
别跟我提以往
别跟我提以往 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:25

    Actually, setting properties on this in created() should work out of the box:

    
    
    
    

    will render

    • item 1
    • item 2

    Demo here: https://codesandbox.io/s/r0yqj2orpn .

提交回复
热议问题