dyn-components
v0.0.7
Published
Dynamic Components
Downloads
32
Readme
dyn-components
Vue 安装
pnpm add unplugin-auto-import unplugin-vue-components dyn-components --save-dev
修改 vite.config.js
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import DynComponents, {
unpluginDynVueComponentsResolver,
unpluginDynVueDirectivesResolver,
unpluginDynVueHookResolver,
unpluginDynReactComponentsResolver,
} from "dyn-components";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
DynComponents(),
AutoImport({
resolvers: [
unpluginDynReactComponentsResolver(),
unpluginDynVueHookResolver(),
],
}),
Components({
resolvers: [
unpluginDynVueComponentsResolver(),
unpluginDynVueDirectivesResolver(),
],
}),
],
// resolve: {
// alias: {
// dyn_components: "/dyn_components",
// },
// },
});
快速开始
// global import theme.css
// 切换暗黑主题设置<html data-theme="dark"></html>
import "dyn-components/theme.css";
<template>
<dyn-vue-json :data="{ foo: 'bar' }"></dyn-vue-json>
</template>