This package has been deprecated

Author message:

rename to `v-forward-ref`, use it instead of this package

@m9ch/vue-forward-ref
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

@m9ch/vue-forward-ref

npm version npm downloads

Install

via pnpm, yarn or npm:

pnpm add @m9ch/vue-forward-ref
# or
yarn add @m9ch/vue-forward-ref
# or
npm i -S @m9ch/vue-forward-ref

How to use

import { forwardRef } from '@m9ch/vue-forward-ref'

const Comp = defineComponent((props, ctx) => {
  ctx.expose({ foo: 'bar' })

  return () => <div>{props.message}</div>
})

const Wrap = forwardRef((props, { slots }, ref) => {
  return <Comp {...props} ref={ref} v-slots={slots} />
})

const App = defineComponent(() => {
  const cmpRef = ref(null)

  onMounted(() => {
    console.log(cmpRef.value.foo) // => 'bar'
  })

  return () => <Wrap message="Hello" ref={cmpRef} />
})

License

MIT © Mitscherlich

Readme

Keywords

none

Package Sidebar

Install

npm i @m9ch/vue-forward-ref

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

7.69 kB

Total Files

8

Last publish

Collaborators

  • mitscherlich36