Skip to content

Commit

Permalink
refactor: 重构layout文件命名规范,更易读 (#1110)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxian521 authored Apr 30, 2024
1 parent 2f9bc7e commit b8159a0
Show file tree
Hide file tree
Showing 53 changed files with 332 additions and 378 deletions.
5 changes: 5 additions & 0 deletions locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,12 @@ menus:
pureChildMenuOverflow: Child Menu Overflow Show Tooltip Text
status:
pureLoad: Loading...
pureMessage: Message
pureNotify: Notify
pureTodo: Todo
pureNoMessage: No Message
pureNoNotify: No Notify
pureNoTodo: No Todo
login:
pureUsername: Username
purePassword: Password
Expand Down
5 changes: 5 additions & 0 deletions locales/zh-CN.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,12 @@ menus:
pureChildMenuOverflow: 菜单超出显示 Tooltip 文字提示
status:
pureLoad: 加载中...
pureMessage: 消息
pureNotify: 通知
pureTodo: 待办
pureNoMessage: 暂无消息
pureNoNotify: 暂无通知
pureNoTodo: 暂无待办
login:
pureUsername: 账号
purePassword: 密码
Expand Down
4 changes: 2 additions & 2 deletions src/components/ReAnimateSelector/src/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defineOptions({
name: "ReAnimateSelector"
});
const props = defineProps({
defineProps({
placeholder: {
type: String,
default: "请选择动画"
Expand Down Expand Up @@ -81,7 +81,7 @@ function onMouseleave() {
<el-select
clearable
filterable
:placeholder="props.placeholder"
:placeholder="placeholder"
popper-class="pure-animate-popper"
:model-value="inputValue"
:filter-method="filterMethod"
Expand Down
4 changes: 2 additions & 2 deletions src/components/ReCropperPreview/src/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defineOptions({
name: "ReCropperPreview"
});
const props = defineProps({
defineProps({
imgSrc: String
});
Expand Down Expand Up @@ -44,7 +44,7 @@ defineExpose({ hidePopover });
<div class="w-[18vw]">
<ReCropper
ref="refCropper"
:src="props.imgSrc"
:src="imgSrc"
circled
@cropper="onCropper"
@readied="showPopover = true"
Expand Down
4 changes: 2 additions & 2 deletions src/components/ReFlowChart/src/DataDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import VueJsonPretty from "vue-json-pretty";
import "vue-json-pretty/lib/styles.css";
const props = defineProps({
defineProps({
graphData: Object
});
</script>
Expand All @@ -12,6 +12,6 @@ const props = defineProps({
:path="'res'"
:deep="3"
:showLength="true"
:data="props.graphData"
:data="graphData"
/>
</template>
2 changes: 1 addition & 1 deletion src/components/ReFlowChart/src/NodePanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const nodeDragNode = item => {
<!-- 左侧bpmn元素选择器 -->
<div class="node-panel">
<div
v-for="item in props.nodeList"
v-for="item in nodeList"
:key="item.text"
class="node-item dark:text-bg_color"
@mousedown="nodeDragNode(item)"
Expand Down
6 changes: 3 additions & 3 deletions src/components/ReSeamlessScroll/src/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ defineExpose({
</script>

<template>
<div :ref="'wrap' + props.classOption['key']">
<div :ref="'wrap' + classOption['key']">
<div
v-if="navigation"
:style="leftSwitch"
Expand All @@ -520,7 +520,7 @@ defineExpose({
<slot name="right-switch" />
</div>
<div
:ref="'realBox' + props.classOption['key']"
:ref="'realBox' + classOption['key']"
:style="pos"
@mouseenter="enter"
@mouseleave="leave"
Expand All @@ -529,7 +529,7 @@ defineExpose({
@touchend="touchEnd"
@mousewheel.passive="wheel"
>
<div :ref="'slotList' + props.classOption['key']" :style="float">
<div :ref="'slotList' + classOption['key']" :style="float">
<slot />
</div>
<div :style="float" v-html="copyHtml" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script setup lang="ts">
import { useI18n } from "vue-i18n";
import Footer from "./footer/index.vue";
import LayFrame from "../lay-frame/index.vue";
import LayFooter from "../lay-footer/index.vue";
import { useGlobal, isNumber } from "@pureadmin/utils";
import KeepAliveFrame from "./keepAliveFrame/index.vue";
import backTop from "@/assets/svg/back_top.svg?component";
import BackTopIcon from "@/assets/svg/back_top.svg?component";
import { h, computed, Transition, defineComponent } from "vue";
import { usePermissionStoreHook } from "@/store/modules/permission";
Expand Down Expand Up @@ -99,15 +99,15 @@ const transitionMain = defineComponent({

<template>
<section
:class="[props.fixedHeader ? 'app-main' : 'app-main-nofixed-header']"
:class="[fixedHeader ? 'app-main' : 'app-main-nofixed-header']"
:style="getSectionStyle"
>
<router-view>
<template #default="{ Component, route }">
<KeepAliveFrame :currComp="Component" :currRoute="route">
<LayFrame :currComp="Component" :currRoute="route">
<template #default="{ Comp, fullPath, frameInfo }">
<el-scrollbar
v-if="props.fixedHeader"
v-if="fixedHeader"
:wrap-style="{
display: 'flex',
'flex-wrap': 'wrap',
Expand All @@ -126,7 +126,7 @@ const transitionMain = defineComponent({
:title="t('buttons.pureBackTop')"
target=".app-main .el-scrollbar__wrap"
>
<backTop />
<BackTopIcon />
</el-backtop>
<div class="grow">
<transitionMain :route="route">
Expand All @@ -150,7 +150,7 @@ const transitionMain = defineComponent({
/>
</transitionMain>
</div>
<Footer v-if="!hideFooter" />
<LayFooter v-if="!hideFooter" />
</el-scrollbar>
<div v-else class="grow">
<transitionMain :route="route">
Expand All @@ -175,12 +175,12 @@ const transitionMain = defineComponent({
</transitionMain>
</div>
</template>
</KeepAliveFrame>
</LayFrame>
</template>
</router-view>

<!-- 页脚 -->
<Footer v-if="!hideFooter && !props.fixedHeader" />
<LayFooter v-if="!hideFooter && !fixedHeader" />
</section>
</template>

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script setup lang="ts">
import { getConfig } from "@/config";
import { useMultiFrame } from "@/layout/hooks/useMultiFrame";
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
import { type Component, shallowRef, watch, computed } from "vue";
import { type RouteRecordRaw, RouteLocationNormalizedLoaded } from "vue-router";
import { useMultiFrame } from "@/layout/components/keepAliveFrame/useMultiFrame";
const props = defineProps<{
currRoute: RouteLocationNormalizedLoaded;
Expand All @@ -20,7 +20,7 @@ const keep = computed(() => {
!!props.currRoute.meta?.frameSrc
);
});
// 避免重新渲染 frameView
// 避免重新渲染 LayFrame
const normalComp = computed(() => !keep.value && props.currComp);
watch(useMultiTagsStoreHook().multiTags, (tags: any) => {
Expand Down Expand Up @@ -65,7 +65,7 @@ watch(
</script>
<template>
<template v-for="[fullPath, Comp] in compList" :key="fullPath">
<div v-show="fullPath === props.currRoute.fullPath" class="w-full h-full">
<div v-show="fullPath === currRoute.fullPath" class="w-full h-full">
<slot
:fullPath="fullPath"
:Comp="Comp"
Expand All @@ -74,6 +74,6 @@ watch(
</div>
</template>
<div v-show="!keep" class="w-full h-full">
<slot :Comp="normalComp" :fullPath="props.currRoute.fullPath" frameInfo />
<slot :Comp="normalComp" :fullPath="currRoute.fullPath" frameInfo />
</div>
</template>
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<script setup lang="ts">
import Search from "./search/index.vue";
import Notice from "./notice/index.vue";
import mixNav from "./sidebar/mixNav.vue";
import { useNav } from "@/layout/hooks/useNav";
import FullScreen from "./sidebar/fullScreen.vue";
import Breadcrumb from "./sidebar/breadCrumb.vue";
import topCollapse from "./sidebar/topCollapse.vue";
import { useTranslationLang } from "../hooks/useTranslationLang";
import globalization from "@/assets/svg/globalization.svg?component";
import LaySearch from "../lay-search/index.vue";
import LayNotice from "../lay-notice/index.vue";
import LayNavMix from "../lay-sidebar/NavMix.vue";
import { useTranslationLang } from "@/layout/hooks/useTranslationLang";
import LaySidebarFullScreen from "../lay-sidebar/components/SidebarFullScreen.vue";
import LaySidebarBreadCrumb from "../lay-sidebar/components/SidebarBreadCrumb.vue";
import LaySidebarTopCollapse from "../lay-sidebar/components/SidebarTopCollapse.vue";
import GlobalizationIcon from "@/assets/svg/globalization.svg?component";
import AccountSettingsIcon from "@iconify-icons/ri/user-settings-line";
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
import Setting from "@iconify-icons/ri/settings-3-line";
Expand All @@ -33,26 +34,26 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();

<template>
<div class="navbar bg-[#fff] shadow-sm shadow-[rgba(0,21,41,0.08)]">
<topCollapse
<LaySidebarTopCollapse
v-if="device === 'mobile'"
class="hamburger-container"
:is-active="pureApp.sidebar.opened"
@toggleClick="toggleSideBar"
/>

<Breadcrumb
<LaySidebarBreadCrumb
v-if="layout !== 'mix' && device !== 'mobile'"
class="breadcrumb-container"
/>

<mixNav v-if="layout === 'mix'" />
<LayNavMix v-if="layout === 'mix'" />

<div v-if="layout === 'vertical'" class="vertical-header-right">
<!-- 菜单搜索 -->
<Search id="header-search" />
<LaySearch id="header-search" />
<!-- 国际化 -->
<el-dropdown id="header-translation" trigger="click">
<globalization
<GlobalizationIcon
class="navbar-bg-hover w-[40px] h-[48px] p-[11px] cursor-pointer outline-none"
/>
<template #dropdown>
Expand Down Expand Up @@ -83,9 +84,9 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();
</template>
</el-dropdown>
<!-- 全屏 -->
<FullScreen id="full-screen" />
<LaySidebarFullScreen id="full-screen" />
<!-- 消息通知 -->
<Notice id="header-notice" />
<LayNotice id="header-notice" />
<!-- 退出登录 -->
<el-dropdown trigger="click">
<span class="el-dropdown-link navbar-bg-hover select-none">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ListItem } from "./data";
import { ListItem } from "../data";
import { ref, PropType, nextTick } from "vue";
import { useNav } from "@/layout/hooks/useNav";
import { deviceDetection } from "@pureadmin/utils";
Expand Down Expand Up @@ -52,9 +52,9 @@ function hoverDescription(event, description) {
class="notice-container border-b-[1px] border-solid border-[#f0f0f0] dark:border-[#303030]"
>
<el-avatar
v-if="props.noticeItem.avatar"
v-if="noticeItem.avatar"
:size="30"
:src="props.noticeItem.avatar"
:src="noticeItem.avatar"
class="notice-container-avatar"
/>
<div class="notice-container-text">
Expand All @@ -63,7 +63,7 @@ function hoverDescription(event, description) {
popper-class="notice-title-popper"
:effect="tooltipEffect"
:disabled="!titleTooltip"
:content="props.noticeItem.title"
:content="noticeItem.title"
placement="top-start"
:enterable="!isMobile"
>
Expand All @@ -72,36 +72,36 @@ function hoverDescription(event, description) {
class="notice-title-content"
@mouseover="hoverTitle"
>
{{ props.noticeItem.title }}
{{ noticeItem.title }}
</div>
</el-tooltip>
<el-tag
v-if="props.noticeItem?.extra"
:type="props.noticeItem?.status"
v-if="noticeItem?.extra"
:type="noticeItem?.status"
size="small"
class="notice-title-extra"
>
{{ props.noticeItem?.extra }}
{{ noticeItem?.extra }}
</el-tag>
</div>

<el-tooltip
popper-class="notice-title-popper"
:effect="tooltipEffect"
:disabled="!descriptionTooltip"
:content="props.noticeItem.description"
:content="noticeItem.description"
placement="top-start"
>
<div
ref="descriptionRef"
class="notice-text-description"
@mouseover="hoverDescription($event, props.noticeItem.description)"
@mouseover="hoverDescription($event, noticeItem.description)"
>
{{ props.noticeItem.description }}
{{ noticeItem.description }}
</div>
</el-tooltip>
<div class="notice-text-datetime text-[#00000073] dark:text-white">
{{ props.noticeItem.datetime }}
{{ noticeItem.datetime }}
</div>
</div>
</div>
Expand Down
24 changes: 24 additions & 0 deletions src/layout/components/lay-notice/components/NoticeList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<script setup lang="ts">
import { PropType } from "vue";
import { ListItem } from "../data";
import NoticeItem from "./NoticeItem.vue";
import { transformI18n } from "@/plugins/i18n";
defineProps({
list: {
type: Array as PropType<Array<ListItem>>,
default: () => []
},
emptyText: {
type: String,
default: ""
}
});
</script>

<template>
<div v-if="list.length">
<NoticeItem v-for="(item, index) in list" :key="index" :noticeItem="item" />
</div>
<el-empty v-else :description="transformI18n(emptyText)" />
</template>
Loading

0 comments on commit b8159a0

Please sign in to comment.