refactor: pinia整合优化重构
This commit is contained in:
@@ -19,10 +19,13 @@
|
||||
import {computed, defineComponent} from 'vue'
|
||||
import { isExternal } from '@/utils/validate'
|
||||
import { useRouter } from 'vue-router'
|
||||
import {useAppStoreHook} from "@/store/modules/app";
|
||||
|
||||
const sidebar = computed(() => useAppStoreHook().sidebar);
|
||||
const device = computed(() => useAppStoreHook().device);
|
||||
import useStore from "@/store";
|
||||
|
||||
const {app}=useStore()
|
||||
|
||||
const sidebar = computed(() => app.sidebar);
|
||||
const device = computed(() => app.device);
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
@@ -35,7 +38,7 @@ export default defineComponent({
|
||||
const router = useRouter()
|
||||
const push = () => {
|
||||
if (device.value === 'mobile' && sidebar.value.opened == true) {
|
||||
useAppStoreHook().closeSideBar(false)
|
||||
app.closeSideBar(false)
|
||||
}
|
||||
router.push(props.to).catch((err) => {
|
||||
console.log(err)
|
||||
|
||||
@@ -39,8 +39,8 @@ import {isExternal} from '@/utils/validate'
|
||||
import AppLink from './Link.vue'
|
||||
import {RouteRecordRaw} from "vue-router";
|
||||
|
||||
import SvgIcon from '@/components/SvgIcon/index.vue';
|
||||
import { generateTitle } from '@/utils/i18n'
|
||||
import SvgIcon from '@/components/SvgIcon/index.vue';
|
||||
|
||||
const props = defineProps({
|
||||
item: {
|
||||
|
||||
@@ -24,20 +24,22 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
|
||||
import {computed, defineComponent} from "vue";
|
||||
import {useRoute} from 'vue-router'
|
||||
|
||||
import SidebarItem from './SidebarItem.vue'
|
||||
import Logo from './Logo.vue'
|
||||
import variables from '@/styles/variables.module.scss'
|
||||
import { useSettingStoreHook } from "@/store/modules/settings";
|
||||
import { useAppStoreHook } from "@/store/modules/app";
|
||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||
import {useRoute} from 'vue-router'
|
||||
import useStore from "@/store";
|
||||
|
||||
const {permission,setting,app} =useStore();
|
||||
|
||||
const route =useRoute()
|
||||
const routes =computed(() => usePermissionStoreHook().routes)
|
||||
const showLogo = computed(() => useSettingStoreHook().sidebarLogo)
|
||||
const isCollapse = computed(() => !useAppStoreHook().sidebar.opened)
|
||||
const routes =computed(() => permission.routes)
|
||||
const showLogo = computed(() => setting.sidebarLogo)
|
||||
const isCollapse = computed(() => !app.sidebar.opened)
|
||||
|
||||
const activeMenu = computed(() => {
|
||||
const {meta, path} = route
|
||||
|
||||
Reference in New Issue
Block a user