Skip to content

Commit

Permalink
chore: remove deps
Browse files Browse the repository at this point in the history
remove `vite-plugin-vue-setup-extend`
  • Loading branch information
chansee97 committed Jun 25, 2023
1 parent 446ee77 commit 4568d80
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 22 deletions.
3 changes: 1 addition & 2 deletions build/plugins/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { PluginOption } from 'vite'
import UnoCSS from '@unocss/vite'
import vueSetupExtend from 'vite-plugin-vue-setup-extend'
import vue from './vue'
import compress from './compress'
import visualizer from './visualizer'
Expand All @@ -15,7 +14,7 @@ import mock from './mock'
* @return {*}
*/
export function setVitePlugins(env: ImportMetaEnv) {
const plugins: PluginOption[] = [...vue, UnoCSS(), ...unplugin, mock, vueSetupExtend()]
const plugins: PluginOption[] = [...vue, UnoCSS(), ...unplugin, mock]
// 是否压缩
if (env.VITE_COMPRESS_OPEN === 'Y')
plugins.push(compress(env))
Expand Down
7 changes: 5 additions & 2 deletions build/plugins/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { viteMockServe } from 'vite-plugin-mock' // https://github.com/vbenjs/vi

export default viteMockServe({
mockPath: 'mock',
// enable: true,
// watchFiles: false,
prodEnabled: true,
injectCode: `
import { setupMockServer } from '../mock';
setupMockServer();
`,
})
6 changes: 1 addition & 5 deletions build/plugins/vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ import vueJsx from '@vitejs/plugin-vue-jsx'
// https://github.com/vitejs/vite/tree/main/packages/plugin-vue-jsx
import VueDevTools from 'vite-plugin-vue-devtools' // https://github.com/webfansplz/vite-plugin-vue-devtools

const plugins = [vue({
script: {
defineModel: true,
},
}), vueJsx(), VueDevTools()]
const plugins = [vue(), vueJsx(), VueDevTools()]

export default plugins
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<title>%VITE_APP_TITLE%</title>
</head>
<body>
<div id="app"><div id="appLoading"></div></div>
<div id="appLoading"></div>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion mock/module/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ const userRoutes = [
],
},
{
name: 'plugin_map',
name: 'PluginMap',
path: '/plugin/map',
meta: {
title: '地图',
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,9 @@
"unplugin-vue-components": "^0.25.1",
"vite": "^4.3.9",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-mock": "^2.9.6",
"vite-plugin-mock": "^2.9.8",
"vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-vue-devtools": "^0.2.1",
"vite-plugin-vue-setup-extend": "^0.4.0",
"vue-tsc": "^1.8.1"
},
"lint-staged": {
Expand Down
2 changes: 0 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import themeConfig from './theme.json'
const locale = zhCN
const dateLocale = dateZhCN
const appStore = useAppStore()
// const osThemeRef = useOsTheme()
// appStore.toggleDarkMode(osThemeRef.value === 'dark')
const themeOverrides: GlobalThemeOverrides = {} || themeConfig
</script>
Expand Down
11 changes: 9 additions & 2 deletions src/components/custom/Editor/MarkDownEditor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ import { MdEditor } from 'md-editor-v3' // https://imzbf.github.io/md-editor-v3/
import 'md-editor-v3/lib/style.css'
import { useAppStore } from '@/store'
const props = defineProps<{
modelValue: string
}>()
const emit = defineEmits(['update:modelValue'])
const appStore = useAppStore()
const modelValue = defineModel()
const data = useVModel(props, 'modelValue', emit)
const theme = computed(() => {
return appStore.darkMode ? 'dark' : 'light'
})
Expand All @@ -23,7 +30,7 @@ const toolbarsExclude: ToolbarNames[] = [

<template>
<MdEditor
v-model="modelValue" :theme="theme" read-only :toolbars-exclude="toolbarsExclude"
v-model="data" :theme="theme" read-only :toolbars-exclude="toolbarsExclude"
/>
</template>

Expand Down
10 changes: 8 additions & 2 deletions src/components/custom/Editor/RichTextEditor/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
<script setup lang="ts">
import Editor from '@tinymce/tinymce-vue'
const modelValue = defineModel()
const props = defineProps<{
modelValue: string
}>()
const emit = defineEmits(['update:modelValue'])
const data = useVModel(props, 'modelValue', emit)
function imagesUploadHandler(blobInfo: any, _progress: number) {
return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -51,7 +57,7 @@ const initConfig = {
<template>
<div class="tinymce-boxz">
<Editor
v-model="modelValue"
v-model="data"
api-key="no-api"
:init="initConfig"
/>
Expand Down
2 changes: 0 additions & 2 deletions src/views/plugin/map/components/AMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,3 @@ async function initMap() {
class="w-full h-full"
/>
</template>

<style scoped></style>
6 changes: 5 additions & 1 deletion src/views/plugin/map/index.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<script lang="ts">
</script>

<script setup lang="ts" name="plugin_map">
<script setup lang="ts">
import AMap from './components/AMap.vue'
import BMap from './components/BMap.vue'
defineOptions({
name: 'PluginMap',
})
const maps = [
{
id: 'AMap',
Expand Down

0 comments on commit 4568d80

Please sign in to comment.