How can I access child component data from a parent in Vue?

前端 未结 1 1195
暗喜
暗喜 2021-01-14 00:51

I am trying to access data from a single-file component in Vue, but can\'t find any way of doing it. I have tried using $emit, but can\'t get thath to work eith

1条回答
  •  时光说笑
    2021-01-14 01:32

    You can use the special attribute ref:

    
    

    In JS:

    vm.$refs.child.YOUR_DATA
    

    Hope this helps!

    0 讨论(0)
提交回复
热议问题