统一甲屿云命名体系
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<Transition name="modal-fade">
|
||||
<div v-if="modelValue" class="modal-mask" @click="close">
|
||||
<section class="modal-panel" @click.stop>
|
||||
<div class="modal-panel__head">
|
||||
<h2>{{ title }}</h2>
|
||||
<button class="modal-panel__close" type="button" :disabled="closeDisabled" @click="close">×</button>
|
||||
</div>
|
||||
<slot />
|
||||
<div v-if="$slots.footer" class="modal-panel__footer">
|
||||
<slot name="footer" />
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const props = defineProps<{
|
||||
modelValue: boolean
|
||||
title: string
|
||||
closeDisabled?: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: boolean]
|
||||
}>()
|
||||
|
||||
const close = (): void => {
|
||||
if (props.closeDisabled) {
|
||||
return
|
||||
}
|
||||
emit('update:modelValue', false)
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<div class="empty-state">
|
||||
<div class="empty-state__mark">{{ mark }}</div>
|
||||
<strong>{{ title }}</strong>
|
||||
<span v-if="description">{{ description }}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
withDefaults(defineProps<{
|
||||
title: string
|
||||
description?: string
|
||||
mark?: string
|
||||
}>(), {
|
||||
mark: '空'
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<div class="loading-state">
|
||||
<div class="loading-state__spinner"></div>
|
||||
<span>{{ text }}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineProps<{
|
||||
text: string
|
||||
}>()
|
||||
</script>
|
||||
@@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<div class="mobile-shell" :class="{ 'mobile-shell--tab': showTab }">
|
||||
<header v-if="showHeader" class="mobile-header">
|
||||
<button class="icon-button" type="button" aria-label="返回" @click="goBack">
|
||||
<ChevronLeft :size="22" />
|
||||
</button>
|
||||
<h1>{{ title }}</h1>
|
||||
<div class="mobile-header__side">
|
||||
<slot name="header-action" />
|
||||
</div>
|
||||
</header>
|
||||
<main class="mobile-page" :class="{ 'mobile-page--plain': plain }">
|
||||
<slot />
|
||||
</main>
|
||||
<TabBar v-if="showTab" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { ChevronLeft } from 'lucide-vue-next'
|
||||
import TabBar from '@/components/TabBar.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
title?: string
|
||||
plain?: boolean
|
||||
hideHeader?: boolean
|
||||
}>()
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const showTab = computed(() => Boolean(route.meta.tab))
|
||||
const showHeader = computed(() => !props.hideHeader && !showTab.value)
|
||||
const title = computed(() => props.title || String(route.meta.title || 'Jayu Salon'))
|
||||
|
||||
const goBack = (): void => {
|
||||
if (window.history.length > 1) {
|
||||
router.back()
|
||||
return
|
||||
}
|
||||
router.replace('/planning')
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,15 @@
|
||||
<template>
|
||||
<section class="section">
|
||||
<div v-if="title || $slots.action" class="section__head">
|
||||
<h2 v-if="title">{{ title }}</h2>
|
||||
<slot name="action" />
|
||||
</div>
|
||||
<slot />
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineProps<{
|
||||
title?: string
|
||||
}>()
|
||||
</script>
|
||||
@@ -0,0 +1,24 @@
|
||||
<template>
|
||||
<nav class="tabbar">
|
||||
<RouterLink v-for="item in tabs" :key="item.path" class="tabbar__item" :to="item.path">
|
||||
<img :src="isActive(item.path) ? item.activeIcon : item.icon" :alt="item.label" />
|
||||
<span>{{ item.label }}</span>
|
||||
</RouterLink>
|
||||
</nav>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
const route = useRoute()
|
||||
const assetPath = (path: string): string => `${import.meta.env.BASE_URL}${path.replace(/^\/+/, '')}`
|
||||
|
||||
const tabs = [
|
||||
{ path: '/planning', label: '规划', icon: assetPath('assets/tabbar/planning.png'), activeIcon: assetPath('assets/tabbar/planning-active.png') },
|
||||
{ path: '/customers', label: '客户', icon: assetPath('assets/tabbar/customers.png'), activeIcon: assetPath('assets/tabbar/customers-active.png') },
|
||||
{ path: '/employees', label: '员工', icon: assetPath('assets/tabbar/employees.png'), activeIcon: assetPath('assets/tabbar/employees-active.png') },
|
||||
{ path: '/profile', label: '我的', icon: assetPath('assets/tabbar/profile.png'), activeIcon: assetPath('assets/tabbar/profile-active.png') }
|
||||
]
|
||||
|
||||
const isActive = (path: string): boolean => route.path === path || route.path.startsWith(`${path}/`)
|
||||
</script>
|
||||
@@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<Transition name="toast-fade">
|
||||
<div v-if="toast.visible" class="toast-host" :class="`toast-host--${toast.kind}`">
|
||||
{{ toast.message }}
|
||||
</div>
|
||||
</Transition>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useToastStore } from '@/stores/toast'
|
||||
|
||||
const toast = useToastStore()
|
||||
</script>
|
||||
Reference in New Issue
Block a user