docs icon indicating copy to clipboard operation
docs copied to clipboard

Update template refs documentation

Open volarname opened this issue 3 years ago • 2 comments

Docs pages https://vuejs.org/guide/typescript/composition-api.html#typing-component-template-refs https://vuejs.org/guide/essentials/template-refs.html#function-refs

Improvement These pages needs these improvements:

  • add method example, not only inline function
  • add typescript version with types of that method (parameters, return type)

Without these changes its really hard to find out correct types for this.

volarname avatar Mar 31 '22 10:03 volarname

@volarname could you please elaborate a bit on "add a method example"? The first link has an example of the component method openModal so I am unsure what exactly is lacking there

NataliaTepluhina avatar May 12 '22 07:05 NataliaTepluhina

@volarname thank you for a reply

I just need to see what types are used for function ref. As you have it splitted to two pages it will be great to update both.

maybe I should switch order of links, its more logical to start from 2nd one:

Here https://vuejs.org/guide/essentials/template-refs.html#function-refs I am missing an separate method example of :ref method, every time I try to move it to separate method to look more clear from inline method I get some weird behavior, should/can the method return something? is there any compile magic in template? what type is el? not-inline working version here should be great, and then because you have separate section for TS: And then here https://vuejs.org/guide/typescript/composition-api.html#typing-component-template-refs I am missing the same method example with types. What type is el parameter? what should/can the method return (void|something)?

This is how i have it right now ant its the only version for me right now where i dont get vue-tsc error:

:ref="(el: any) => { datatables[system] = el }"

it really need to add types and move to own function, but dont know how

volarname avatar May 12 '22 07:05 volarname