unplugin-vue-map-ui
v0.0.14
Published
Components resolver for auto importing
Downloads
3,658
Readme
unplugin-vue-map-ui
On-demand components auto importing for vue-map-ui.
Installation
npm install -D unplugin-vue-map-ui unplugin-vue-components
// vite.config.ts
import { defineConfig } from 'vite';
import Components from 'unplugin-vue-components/vite';
import { VueMapUiResolver, VueMapUiPreset } from 'unplugin-vue-map-ui';
export default defineConfig({
// ...
plugins: [
// ...
Components({
resolvers: [VueMapUiResolver()],
types: [VueMapUiPreset]
})
]
});
// webpack.config.js
const Components = require('unplugin-vue-components/webpack');
const { VueMapUiResolver, VueMapUiPreset } = require('unplugin-vue-map-ui');
module.exports = {
// ...
plugins: [
Components({
resolvers: [VueMapUiResolver()],
types: [VueMapUiPreset]
})
]
};
Usage
It will automatically turn this
<script setup>
//...
</script>
<template>
<VMap>
<VMapOsmTileLayer />
</VMap>
</template>
into this
<script setup>
import { VMap, VMapOsmTileLayer } from 'vue-map-ui';
//...
</script>
<template>
<VMap>
<VMapOsmTileLayer />
</VMap>
</template>
TypeScript
Make sure you also add components.d.ts
to your tsconfig.json
under include
.
// tsconfig.json
{
// ...
"include": ["components.d.ts"]
}
License
Licensed under the MIT License.