Browse Source

调整微服务工具包导出内容

tongshangming 1 year ago
parent
commit
8507e55b09

+ 1 - 1
.prettierrc.js

@@ -13,6 +13,6 @@ export default {
   insertPragma: false,
   // proseWrap: 'preserve',
   htmlWhitespaceSensitivity: 'css',
-  endOfLine: 'lf',
+  endOfLine: 'auto',
   arrowParens: 'avoid'
 }

+ 1 - 1
src/App.vue

@@ -1,7 +1,7 @@
 <script setup lang="ts">
 import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
 import { useThemeStore } from '@/stores/theme'
-import { isMicro } from '@/config/mainMicro'
+import { isMicro } from '@/utils/micro'
 import { microName } from '@/config/subMicro'
 
 const locale = zhCn

+ 0 - 2
src/config/mainMicro.ts

@@ -23,5 +23,3 @@ export const microList = microConfig.map((item: any) => {
   item.url = item.url[import.meta.env.MODE]
   return item
 })
-
-export const isMicro = window.__POWERED_BY_WUJIE__

+ 2 - 1
src/hooks/useMainMicro.ts

@@ -1,5 +1,6 @@
 import WujieVue from 'wujie-vue3'
-import { isMicro, microList } from '@/config/mainMicro'
+import { isMicro } from '@/utils/micro'
+import { microList } from '@/config/mainMicro'
 import { useUserStore } from '@/stores/user'
 import router from '@/router'
 import type { App } from 'vue'

+ 2 - 1
src/hooks/useTable.ts

@@ -1,4 +1,3 @@
-import router from '@/router'
 import { ElMessage, ElMessageBox } from 'element-plus'
 
 export const useTable = (props: any, emits: any) => {
@@ -49,6 +48,7 @@ export const useTable = (props: any, emits: any) => {
   const doCreate = () => {
     emits('click-create')
     if (formRoute.value) {
+      const router = useRouter()
       router.push(formRoute.value)
     } else {
       formData.value = {}
@@ -79,6 +79,7 @@ export const useTable = (props: any, emits: any) => {
   const useRecordData = (row: any, disabled: boolean) => {
     // 此函数用于获取记录数据并设置相应的表单配置
     if (formRoute.value) {
+      const router = useRouter()
       router.push(formRoute.value)
     } else {
       if (props.crud?.getRecord) {

+ 1 - 1
src/layouts/BasicLayout.vue

@@ -1,7 +1,7 @@
 <script setup lang="ts">
 import { useRouterStore } from '@/stores/router'
 import { useThemeStore } from '@/stores/theme'
-import { isMicro } from '@/config/mainMicro'
+import { isMicro } from '@/utils/micro'
 
 const routerStore = useRouterStore()
 const themeStore = useThemeStore()

+ 2 - 1
src/utils/micro.ts

@@ -1,6 +1,7 @@
-import { isMicro } from '@/config/mainMicro'
 import { useUserStore } from '@/stores/user'
 
+export const isMicro = window.__POWERED_BY_WUJIE__
+
 export const logout = () => {
   if (isMicro) {
     window.$wujie?.bus.$emit('logout')