Skip to content

penjj/vhoc

Repository files navigation

Create higher order vue3 components.

Documentation: https://penjj.github.io/vhoc/

Playground: https://stackblitz.com/edit/vitejs-vite-jqkxzj?file=src/App.vue

Install

pnpm i vhoc -S

Usage

import { withProps } from 'vhoc'

const MyInput = withProps(Input)({
  placeholder: 'Please enter.'
})

<MyInput /> // <Input placeholder="Please enter." />
<MyInput placeholder="Hello world." /> // <Input placeholder="Hello world." />

With unplugin-auto-import

// vite.config.js
import { VhocImports } from "vhoc/imports";

export default defineConfig({
  plugins: [
    AutoImport({
      imports: [VhocImports()],
    }),
  ],
});

About

Create high order Vue3 components.

Resources

License

Stars

Watchers

Forks

Packages

No packages published