Skip to content

Latest commit

 

History

History
49 lines (35 loc) · 861 Bytes

README.md

File metadata and controls

49 lines (35 loc) · 861 Bytes

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()],
    }),
  ],
});