-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add unplugin-vue-components integration docs
- Loading branch information
Showing
9 changed files
with
123 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { BaseBlock } from './../../runtime'; | ||
import { definePageConfigBlock } from '../../types' | ||
import Component from './index.vue' | ||
|
||
export default definePageConfigBlock({ | ||
setup (tabs: Record<string, BaseBlock[]>) { | ||
return { | ||
type: 'collapse' as const, | ||
tabs | ||
} | ||
}, | ||
component: Component, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<template> | ||
<VaTabs v-model="value" class="mt-2"> | ||
<template #tabs> | ||
<VaTab | ||
v-for="tab in tabNames" | ||
:key="tab" | ||
> | ||
{{ tab }} | ||
</VaTab> | ||
</template> | ||
</VaTabs> | ||
<PageConfigBlocks :blocks="tabs[tabNames[value]]" /> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref, computed } from 'vue' | ||
import { BaseBlock } from './../../runtime'; | ||
import PageConfigBlocks from '../../runtime/PageConfigBlocks.vue'; | ||
const value = ref(0) | ||
const props = defineProps<{ | ||
tabs: Record<string, BaseBlock[]> | ||
}>() | ||
const tabNames = computed(() => Object.keys(props.tabs)) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
packages/docs/page-config/extensions/unplugin-vue-components/code/installation.vite.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// vite.config.ts | ||
import { defineConfig } from 'vite'; | ||
import Components from 'unplugin-vue-components/vite' | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
Components({ | ||
resolvers: [ | ||
(componentName) => { | ||
if (componentName.startsWith('Va')) | ||
return { name: componentName, from: 'vuestic-ui' } | ||
}, | ||
], | ||
}), | ||
], | ||
}); |
14 changes: 14 additions & 0 deletions
14
packages/docs/page-config/extensions/unplugin-vue-components/code/installation.webpack.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// webpack.config.js | ||
module.exports = { | ||
/* ... */ | ||
plugins: [ | ||
require('unplugin-vue-components/webpack').default({ | ||
resolvers: [ | ||
(componentName) => { | ||
if (componentName.startsWith('Va')) | ||
return { name: componentName, from: 'vuestic-ui' } | ||
}, | ||
], | ||
}), | ||
], | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/docs/page-config/extensions/unplugin-vue-components/code/vuestic-setup.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { createApp } from "vue"; | ||
import { createVuesticEssential } from "vuestic-ui"; | ||
import "vuestic-ui/css"; | ||
import App from "./App.vue"; | ||
|
||
createApp(App) | ||
.use( | ||
createVuesticEssential({ | ||
config: { | ||
/* ... */ | ||
}, | ||
}) | ||
) | ||
.mount("#app"); |
22 changes: 22 additions & 0 deletions
22
packages/docs/page-config/extensions/unplugin-vue-components/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export default definePageConfig({ | ||
blocks: [ | ||
block.title('Unplugin Vue Components'), | ||
block.paragraph('[Unplugin Vue Components](https://github.com/unplugin/unplugin-vue-components) is a Vite/Webpack plugin that automatically imports Vue components from your dependencies.'), | ||
block.paragraph('You can use to import components from Vuestic UI without registering them globally or importing them in every file.'), | ||
|
||
block.tabs({ | ||
'vite': [ | ||
block.code('installation.vite') | ||
], | ||
'webpack': [ | ||
block.code('installation.webpack') | ||
], | ||
}), | ||
|
||
block.paragraph('After installing the plugin, you can use components from Vuestic UI without importing them. But you need to prevent them from global registration. Use `createVuesticEssential` to register Vuestic without global components. Read more about tree-shaking [here](/getting-started/tree-shaking)'), | ||
|
||
block.code('vuestic-setup'), | ||
|
||
block.paragraph('When working with [Nuxt](/getting-started/nuxt) this feature is built-in.'), | ||
] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters