在你的SFC里面有SFC.
Nest SFCs within your SFC.
Install package:
# npm
npm install -D vite-plugin-vue-nested-sfc
# yarn
yarn add -D vite-plugin-vue-nested-sfc
# pnpm
pnpm add -D vite-plugin-vue-nested-sfcAdd to vite config:
// vite.config.js
import vue from "@vitejs/plugin-vue";
import vueNestedSFC from "vite-plugin-vue-nested-sfc";
export default {
plugins: [vue(), vueNestedSFC()],
};Add volar plugin for IDE support:
// tsconfig.app.json
{
"vueCompilerOptions": {
"plugins": ["vite-plugin-vue-nested-sfc/tooling"]
}
}Nested components are defined with the `` block. The block's content is treated as if it's a seperate SFC.
Hello World!
You can export nested components with the export attribute.
Import them from other files as named exports.
Click me
Made with
Published under MIT License.
暂无开放 Issues,或尚未同步最近议题。