完善页面细节2
This commit is contained in:
@@ -150,6 +150,21 @@
|
||||
1. **转为静态导入**: 在 `adminComponentMap.uts` 顶部使用静态 `import` 导入所有管理端子页面组件。
|
||||
2. **组件映射**: 维护 `componentMap` 为静态 Map,避免在运行时使用 `defineAsyncComponent`,从而提高页面的加载成功率和抗语法错误风险。
|
||||
|
||||
#### **原因二十二:Tab 切换高度抖动 (Tab Switching Height Jitter)**
|
||||
|
||||
- **现象**: 在包含多标签切换的配置页面中,切换不同标签时,由于内容块高度差异较大,导致整个容器或页面产生明显的跳动/收缩。
|
||||
- **原因**: 每个 `v-if` 或 `v-show` 对应的内容高度不一致,且父容器没有设置 `min-height` 进行视觉对齐。
|
||||
- **解决方案**: 为切换内容的公共父容器(如 `.config-body` 或 `.tab-content`)设置一个统一的 `min-height`(推荐 400px - 600px 之间,视表单复杂度而定),确保最矮的标签页下仍能撑开容器。
|
||||
|
||||
#### **原因二十三:循环依赖导致的 500 错误 (Circular Dependency & AdminLayout)**
|
||||
|
||||
- **现象**: 浏览器报 `500 Internal Server Error`,控制台显示 `Failed to fetch dynamically imported module` 或 `net::ERR_ABORTED`。
|
||||
- **原因**: 核心布局组件 `AdminLayout.uvue` 导入了 `adminComponentMap.uts`(用于动态渲染子页面),而子页面内部又通过 `import AdminLayout` 引用了布局组件。这种循环依赖在 Vite/UTS 环境下会导致整个加载链路崩溃。
|
||||
- **解决方案**:
|
||||
1. 所有在 `adminComponentMap.uts` 中注册的**子页面**(Sub-pages),**严禁**在 `<template>` 中包裹 `<AdminLayout>`,也**严禁**在 `<script>` 中 `import AdminLayout`。
|
||||
2. 布局由主入口统一提供,子页面只需编写内容区的 `<view>`。
|
||||
3. **例外**: 仅当某个页面是独立存在的(例如登录页、引导页),且需要独立布局时,才允许自行包装。
|
||||
|
||||
## 🛠️ 完整修复流程
|
||||
|
||||
```
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<template>
|
||||
<AdminLayout current-page="maintain_dev_config">
|
||||
<view class="admin-page category-page">
|
||||
<view class="admin-sections">
|
||||
<!-- 筛选区域 (1:1 复刻 CRMEB: 横向排列的过滤器) -->
|
||||
@@ -70,12 +69,10 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</AdminLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref } from 'vue'
|
||||
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
|
||||
|
||||
const categoryList = ref([
|
||||
{ id: 9, name: '分销配置', field: 'fenxiao', status: true },
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
<template>
|
||||
<AdminLayout current-page="maintain_dev_data">
|
||||
<view class="admin-page">
|
||||
<view class="admin-sections">
|
||||
<!-- 搜索栏 -->
|
||||
<view class="admin-card filter-card">
|
||||
<view class="filter-row">
|
||||
<view class="filter-item">
|
||||
<text class="label">数据搜索:</text>
|
||||
<input class="filter-input input-large" placeholder="请输入ID,KEY,数据组名称,简介" />
|
||||
</view>
|
||||
<button class="btn primary" @click="onSearch">查询</button>
|
||||
<view class="admin-page">
|
||||
<view class="admin-sections">
|
||||
<!-- 搜索栏 -->
|
||||
<view class="admin-card filter-card">
|
||||
<view class="filter-row">
|
||||
<view class="filter-item">
|
||||
<text class="label">数据搜索:</text>
|
||||
<input class="filter-input input-large" placeholder="请输入ID,KEY,数据组名称,简介" />
|
||||
</view>
|
||||
<button class="btn primary" @click="onSearch">查询</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 内容区 -->
|
||||
<view class="admin-card content-card">
|
||||
@@ -49,12 +48,10 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</AdminLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref } from 'vue'
|
||||
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
|
||||
|
||||
const dataList = ref([
|
||||
{ id: 49, key: 'routine_seckill_time', name: '秒杀时间段', desc: '秒杀时间段' },
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<AdminLayout current-page="maintain_dev_task">
|
||||
<view class="admin-page">
|
||||
<view class="admin-page">
|
||||
<view class="admin-sections">
|
||||
<!-- 顶部通知 -->
|
||||
<view class="admin-card alert-card">
|
||||
@@ -50,12 +49,10 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</AdminLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref } from 'vue'
|
||||
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
|
||||
|
||||
const dataList = ref([
|
||||
{ id: 1, title: '自动开具/冲红电子发票', desc: '每隔10分钟执行自动开具/冲红电子发票', cycle: '每隔10分钟执行一次', status: true },
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<template>
|
||||
<AdminLayout current-page="maintain_dev_event">
|
||||
<view class="admin-page">
|
||||
<view class="admin-sections">
|
||||
<!-- 提示语 -->
|
||||
@@ -37,11 +36,9 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</AdminLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
|
||||
|
||||
function onAdd() {
|
||||
uni.showToast({ title: '新增系统事件', icon: 'none' })
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<AdminLayout current-page="maintain_dev_module">
|
||||
<view class="admin-page">
|
||||
<view class="admin-page">
|
||||
<view class="admin-sections">
|
||||
<view class="admin-card content-card">
|
||||
<view class="form-container">
|
||||
@@ -31,11 +30,9 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</AdminLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
|
||||
function onSubmit() {
|
||||
uni.showToast({ title: '已提交', icon: 'none' })
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<AdminLayout current-page="maintain_dev_auth">
|
||||
<view class="admin-page">
|
||||
<view class="admin-page">
|
||||
<view class="admin-sections">
|
||||
<!-- 搜索栏 -->
|
||||
<view class="admin-card filter-card">
|
||||
@@ -65,12 +64,10 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</AdminLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref } from 'vue'
|
||||
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
|
||||
|
||||
const dataList = ref([
|
||||
{ id: 1, name: '主页', auth: 'admin-home', route: '菜单: /admin/index', status: true, memo: '主页' },
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<template>
|
||||
<AdminLayout currentPage="maintain-dev-config">
|
||||
<view class="admin-maintain-config">
|
||||
<view class="page-header border-shadow">
|
||||
<text class="page-title">开发配置 - 配置分类</text>
|
||||
@@ -30,11 +29,9 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</AdminLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<AdminLayout current-page="maintain_security_upgrade">
|
||||
<view class="admin-page">
|
||||
<view class="admin-page">
|
||||
<view class="admin-sections">
|
||||
<!-- 提示栏 -->
|
||||
<view class="alert-info">
|
||||
@@ -58,12 +57,10 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</AdminLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref } from 'vue'
|
||||
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
|
||||
|
||||
const activeTab = ref('upgrade')
|
||||
const tabs = [
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<AdminLayout currentPage="maintain-security-refresh-cache">
|
||||
<view class="admin-page">
|
||||
<view class="admin-page">
|
||||
<view class="admin-sections">
|
||||
<view class="admin-grid-2">
|
||||
<!-- 清除缓存 -->
|
||||
@@ -23,11 +22,9 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</AdminLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
|
||||
|
||||
function onClearCache() {
|
||||
uni.showModal({
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<AdminLayout currentPage="maintain-sys-info">
|
||||
<view class="admin-page">
|
||||
<view class="admin-page">
|
||||
<view class="admin-sections">
|
||||
<!-- 商业授权 -->
|
||||
<view class="admin-card info-section">
|
||||
@@ -99,11 +98,9 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</AdminLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
|
||||
function gotoOfficial() {
|
||||
uni.showToast({ title: '正在打开官网...', icon: 'none' })
|
||||
}
|
||||
|
||||
@@ -124,10 +124,6 @@ const handleSubmit = () => {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.admin-marketing-integral-config {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.box-shadow {
|
||||
background-color: #fff;
|
||||
border-radius: 4px;
|
||||
@@ -169,6 +165,7 @@ const handleSubmit = () => {
|
||||
|
||||
.config-body {
|
||||
padding: 40px 60px;
|
||||
min-height: 480px;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
<template>
|
||||
<AdminLayout :currentPage="currentPage">
|
||||
<view class="page">
|
||||
<view class="header">
|
||||
<text class="title">{{ title }}</text>
|
||||
<text class="sub-title">页面占位 (自动生成)</text>
|
||||
</view>
|
||||
</view>
|
||||
</AdminLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref } from 'vue'
|
||||
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
|
||||
const currentPage = ref<string>('points-config')
|
||||
const title = ref<string>('config')
|
||||
</script>
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
<template>
|
||||
<AdminLayout :currentPage="currentPage">
|
||||
<view class="page">
|
||||
<view class="header">
|
||||
<text class="title">{{ title }}</text>
|
||||
<text class="sub-title">页面已修复 (UTF-8)</text>
|
||||
</view>
|
||||
</view>
|
||||
</AdminLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref } from 'vue'
|
||||
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
|
||||
const currentPage = ref<string>('goods')
|
||||
const title = ref<string>('goods')
|
||||
</script>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<template>
|
||||
<AdminLayout :currentPage="currentPage">
|
||||
<view class="Page">
|
||||
<view class="Header">
|
||||
<text class="Title">积分统计</text>
|
||||
@@ -11,13 +10,11 @@
|
||||
<text class="Mono">{{ params }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</AdminLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref, computed } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
|
||||
|
||||
const params = ref('')
|
||||
const tab = ref('stats')
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
<template>
|
||||
<AdminLayout :currentPage="currentPage">
|
||||
<view class="page">
|
||||
<view class="header">
|
||||
<text class="title">{{ title }}</text>
|
||||
<text class="sub-title">页面占位 (自动生成)</text>
|
||||
</view>
|
||||
</view>
|
||||
</AdminLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref } from 'vue'
|
||||
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
|
||||
const currentPage = ref<string>('points-record')
|
||||
const title = ref<string>('record')
|
||||
</script>
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
<template>
|
||||
<AdminLayout :currentPage="currentPage">
|
||||
<view class="page">
|
||||
<view class="header">
|
||||
<text class="title">{{ title }}</text>
|
||||
<text class="sub-title">积分统计数据,包含积分发放和消费情况?</text>
|
||||
</view>
|
||||
</view>
|
||||
</AdminLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref } from 'vue'
|
||||
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
|
||||
const currentPage = ref<string>('points-stats')
|
||||
const title = ref<string>('积分统计')
|
||||
</script>
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<template>
|
||||
<AdminLayout>
|
||||
<view class="marketing-seckill-list">
|
||||
<view class="filter-card border-shadow">
|
||||
<view class="filter-row">
|
||||
<view class="filter-item">
|
||||
<text class="label">活动搜索:</text>
|
||||
<input class="input-mock" placeholder="请输入活动名称, ID" />
|
||||
</view>
|
||||
<view class="marketing-seckill-list">
|
||||
<view class="filter-card border-shadow">
|
||||
<view class="filter-row">
|
||||
<view class="filter-item">
|
||||
<text class="label">活动搜索:</text>
|
||||
<input class="input-mock" placeholder="请输入活动名称, ID" />
|
||||
</view>
|
||||
<view class="filter-item">
|
||||
<text class="label">活动状态:</text>
|
||||
<view class="select-mock">
|
||||
@@ -118,11 +117,9 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</AdminLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
|
||||
import { ref } from 'vue'
|
||||
|
||||
const seckillList = ref([
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<template>
|
||||
<AdminLayout currentPage="product_paramList">
|
||||
<view class="admin-main">
|
||||
<!-- 头部搜索 -->
|
||||
<view class="search-card">
|
||||
@@ -99,12 +98,10 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</AdminLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref, reactive } from 'vue'
|
||||
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
|
||||
|
||||
interface ParamKV {
|
||||
label: string;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<template>
|
||||
<AdminLayout current-page="setting_system_config">
|
||||
<view class="admin-page">
|
||||
<view class="admin-sections">
|
||||
<view class="admin-card settings-card">
|
||||
@@ -71,12 +70,10 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</AdminLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref } from "vue"
|
||||
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
|
||||
|
||||
const currentTab = ref(8) // 默认打开截图中的“WAF配置”
|
||||
const tabs = [
|
||||
|
||||
Reference in New Issue
Block a user