diff --git a/front-end/mall4v/src/layout/main-content.vue b/front-end/mall4v/src/layout/main-content.vue index cd16490..90f6718 100644 --- a/front-end/mall4v/src/layout/main-content.vue +++ b/front-end/mall4v/src/layout/main-content.vue @@ -1,85 +1,125 @@ + - - - {{ item }} - - + + + + {{ item }} + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/front-end/mall4v/src/layout/main-navbar-update-password.vue b/front-end/mall4v/src/layout/main-navbar-update-password.vue index e981fd9..195b955 100644 --- a/front-end/mall4v/src/layout/main-navbar-update-password.vue +++ b/front-end/mall4v/src/layout/main-navbar-update-password.vue @@ -1,121 +1,157 @@ + - - - {{ userName }} - - - - - - - - - - - - + + + + + {{ userName }} + + + + + + + + + + + + + + + + + + + + - 取消 + 取消 确定 - + diff --git a/front-end/mall4v/src/layout/main-navbar.vue b/front-end/mall4v/src/layout/main-navbar.vue index e5cd724..627e51b 100644 --- a/front-end/mall4v/src/layout/main-navbar.vue +++ b/front-end/mall4v/src/layout/main-navbar.vue @@ -1,172 +1,219 @@ + - + - - - - - - - mall4j建站后台 - - - mall4j - - - - - - - - - - - {{ userName }} - - - - 修改密码 - - - 退出 - - - - - - - - + + + + mall4j建站后台 + + + mall4j + + + + + + + + + - + + + + + + + {{ userName }} + + + + + 修改密码 + + + 退出 + + + + + + + + + + diff --git a/front-end/mall4v/src/layout/main-sidebar-sub-menu-item.vue b/front-end/mall4v/src/layout/main-sidebar-sub-menu-item.vue index 867e1af..7c461e8 100644 --- a/front-end/mall4v/src/layout/main-sidebar-sub-menu-item.vue +++ b/front-end/mall4v/src/layout/main-sidebar-sub-menu-item.vue @@ -1,125 +1,154 @@ + + - - {{ expandMenu.name }} + + + {{ expandMenu.name }} + + + + + + + + {{ menu.name }} + + + - - - - {{ menu.name }} - - - - + + + + - {{ - expandMenu.name - }} + {{ expandMenu.name }} diff --git a/front-end/mall4v/src/layout/main-sidebar-sub-menu.vue b/front-end/mall4v/src/layout/main-sidebar-sub-menu.vue index 6322391..f8fbe0c 100644 --- a/front-end/mall4v/src/layout/main-sidebar-sub-menu.vue +++ b/front-end/mall4v/src/layout/main-sidebar-sub-menu.vue @@ -1,41 +1,53 @@ + + - + + diff --git a/front-end/mall4v/src/layout/main-sidebar.vue b/front-end/mall4v/src/layout/main-sidebar.vue index 797e6a2..0dd4ea6 100644 --- a/front-end/mall4v/src/layout/main-sidebar.vue +++ b/front-end/mall4v/src/layout/main-sidebar.vue @@ -1,105 +1,124 @@ + {{ menu.name }} // 显示菜单名称 + + + + + + + + + + diff --git a/front-end/mall4v/src/layout/main.vue b/front-end/mall4v/src/layout/main.vue index 4967b79..825c0ac 100644 --- a/front-end/mall4v/src/layout/main.vue +++ b/front-end/mall4v/src/layout/main.vue @@ -1,59 +1,84 @@ + - - - - - - - + + + + + + + + + + + + + + diff --git a/front-end/mall4v/src/router/index.js b/front-end/mall4v/src/router/index.js index 013bf38..12370c3 100644 --- a/front-end/mall4v/src/router/index.js +++ b/front-end/mall4v/src/router/index.js @@ -5,67 +5,70 @@ import { clearLoginInfo } from '@/utils' import Layout from '@/layout/main.vue' import Login from '@/views/common/login/index.vue' -// 全局路由(无需嵌套上左右整体布局) +// 定义全局路由(无需嵌套在左右整体布局中) const globalRoutes = [ { - path: '/404', - component: () => import('@/views/common/error-page/404.vue'), - name: '404', - meta: { title: '404未找到' } + path: '/404', // 404 页面路径 + component: () => import('@/views/common/error-page/404.vue'), // 动态导入 404 页面组件 + name: '404', // 路由名称 + meta: { title: '404未找到' } // 元信息,用于设置页面标题等 }, { - path: '/login', - component: Login, - name: 'login', - meta: { title: '登录' } + path: '/login', // 登录页面路径 + component: Login, // 登录页面组件 + name: 'login', // 路由名称 + meta: { title: '登录' } // 元信息,用于设置页面标题等 } ] +// 定义主路由(需要嵌套在 Layout 组件中) export const mainRoutes = { - path: '/', - component: Layout, - name: 'home', - redirect: '/home', - children: [ + path: '/', // 根路径 + component: Layout, // 布局组件 + name: 'home', // 路由名称 + redirect: '/home', // 默认重定向到 home 页面 + children: [ // 子路由 { - path: 'home', - name: 'home', - component: () => import('@/views/common/home/index.vue') + path: 'home', // 主页路径 + name: 'home', // 路由名称 + component: () => import('@/views/common/home/index.vue') // 动态导入主页组件 }, { - path: '/prodInfo', - name: 'prodInfo', - component: () => import('@/views/modules/prod/prodInfo/index.vue') + path: '/prodInfo', // 产品信息页面路径 + name: 'prodInfo', // 路由名称 + component: () => import('@/views/modules/prod/prodInfo/index.vue') // 动态导入产品信息页面组件 } ], - // eslint-disable-next-line no-unused-vars - beforeEnter (to, from, next) { - const authorization = cookie.get('Authorization') - if (!authorization || !/\S/.test(authorization)) { - clearLoginInfo() - next({ name: 'login' }) + beforeEnter (to, from, next) { // 路由守卫,检查用户是否已登录 + const authorization = cookie.get('Authorization') // 获取存储在 cookie 中的授权信息 + if (!authorization || !/\S/.test(authorization)) { // 如果没有授权信息或为空 + clearLoginInfo() // 清除登录信息 + next({ name: 'login' }) // 重定向到登录页面 } - next() + next() // 否则继续导航 } } +// 创建 Vue Router 实例 const router = createRouter({ - history: createWebHistory(), - scrollBehavior: () => ({ top: 0 }), + history: createWebHistory(), // 使用 HTML5 History 模式 + scrollBehavior: () => ({ top: 0 }), // 设置滚动行为,每次导航回到顶部 isAddDynamicMenuRoutes: false, // 是否已经添加动态(菜单)路由 - routes: globalRoutes.concat(mainRoutes) + routes: globalRoutes.concat(mainRoutes) // 合并全局路由和主路由 }) -// eslint-disable-next-line no-unused-vars +// 全局前置守卫,拦截所有路由导航 router.beforeEach((to, from, next) => { - const commonStore = useCommonStore() - // 添加动态(菜单)路由 - // 1. 已经添加 or 全局路由, 直接访问 - // 2. 获取菜单列表, 添加并保存本地存储 + const commonStore = useCommonStore() // 初始化 Vuex store 实例 + + // 添加动态(菜单)路由逻辑 if (router.options.isAddDynamicMenuRoutes || fnCurrentRouteType(to, globalRoutes) === 'global') { - const routeList = commonStore.routeList - let navTitles = [] - let leftMenuId = '' + // 已经添加动态路由或访问的是全局路由,直接处理导航 + const routeList = commonStore.routeList // 获取路由列表 + let navTitles = [] // 用于存储导航标题 + let leftMenuId = '' // 用于存储左侧菜单 ID + + // 查找当前路由对应的菜单项,并构建导航标题链 routeList.forEach(item => { if (to.meta.menuId === item.menuId) { navTitles.push(item.name) @@ -83,30 +86,37 @@ router.beforeEach((to, from, next) => { }) } }) - navTitles = navTitles.reverse() + + navTitles = navTitles.reverse() // 反转导航标题链 + + // 更新 Vuex store 中的状态 if (to.meta.isLeftMenu || to.path === '/home' || leftMenuId) { if (leftMenuId) { - commonStore.updateSelectLeftId(leftMenuId) - commonStore.updateSelectRightId(to.meta.menuId) + commonStore.updateSelectLeftId(leftMenuId) // 更新选中的左侧菜单 ID + commonStore.updateSelectRightId(to.meta.menuId) // 更新选中的右侧菜单 ID } else { - commonStore.updateSidebarFold(true) - commonStore.updateSelectLeftId(to.path === '/home' ? '' : to.meta.menuId) + commonStore.updateSidebarFold(true) // 折叠侧边栏 + commonStore.updateSelectLeftId(to.path === '/home' ? '' : to.meta.menuId) // 更新选中的左侧菜单 ID } } - commonStore.updateSelectMenu(navTitles) - next() + + commonStore.updateSelectMenu(navTitles) // 更新选中的菜单标题链 + next() // 继续导航 } else { + // 请求菜单列表和权限信息 http({ - url: http.adornUrl('/sys/menu/nav'), - method: 'get', - params: http.adornParams() + url: http.adornUrl('/sys/menu/nav'), // 请求 URL + method: 'get', // 请求方法 + params: http.adornParams() // 请求参数 }).then(({ data }) => { - sessionStorage.setItem('Authorities', JSON.stringify(data.authorities || '[]')) - fnAddDynamicMenuRoutes(data.menuList) - router.options.isAddDynamicMenuRoutes = true + sessionStorage.setItem('Authorities', JSON.stringify(data.authorities || '[]')) // 存储权限信息到 sessionStorage + fnAddDynamicMenuRoutes(data.menuList) // 添加动态路由 + router.options.isAddDynamicMenuRoutes = true // 标记动态路由已添加 + + // 构建完整的路由列表,并保存到 Vuex store 和 sessionStorage const rList = [] data.menuList.forEach(item => { - item.isLeftMenu = item.parentId === 0 + item.isLeftMenu = item.parentId === 0 // 判断是否为左侧菜单 rList.push({ menuId: item.menuId, name: item.name, @@ -136,81 +146,92 @@ router.beforeEach((to, from, next) => { }) } }) - fnAddDynamicMenuRoutes(data.menuList) - sessionStorage.setItem('menuList', JSON.stringify(data.menuList || '[]')) - commonStore.updateRouteList(rList) - commonStore.updateMenuIds(rList) + + fnAddDynamicMenuRoutes(data.menuList) // 再次调用以确保所有子菜单被正确添加 + sessionStorage.setItem('menuList', JSON.stringify(data.menuList || '[]')) // 存储菜单列表到 sessionStorage + commonStore.updateRouteList(rList) // 更新 Vuex store 中的路由列表 + commonStore.updateMenuIds(rList) // 更新 Vuex store 中的菜单 ID 列表 + + // 重新导航到目标页面 next({ ...to, replace: true }) }).catch(e => { - // eslint-disable-next-line no-console - console.log(`%c${e} 请求菜单列表和权限失败,跳转至登录页!!`, 'color:blue') - router.push({ name: 'login' }) + console.log(`%c${e} 请求菜单列表和权限失败,跳转至登录页!!`, 'color:blue') // 打印错误信息 + router.push({ name: 'login' }) // 跳转到登录页面 }) } }) /** - * 判断当前路由类型, global: 全局路由, main: 主入口路由 - * @param {*} route 当前路由 - * @param globalRoutes 全局路由 + * 判断当前路由类型,返回 'global' 或 'main' + * @param {*} route 当前路由对象 + * @param globalRoutes 全局路由数组 */ function fnCurrentRouteType (route, globalRoutes = []) { - let temp = [] + let temp = [] // 临时存储子路由 for (let i = 0; i < globalRoutes.length; i++) { if (route.path === globalRoutes[i].path) { - return 'global' + return 'global' // 如果匹配到全局路由,返回 'global' } else if (globalRoutes[i].children && globalRoutes[i].children.length >= 1) { - temp = temp.concat(globalRoutes[i].children) + temp = temp.concat(globalRoutes[i].children) // 将子路由添加到临时数组 } } - return temp.length >= 1 ? fnCurrentRouteType(route, temp) : 'main' + return temp.length >= 1 ? fnCurrentRouteType(route, temp) : 'main' // 递归查找子路由,直到找到匹配项或返回 'main' } /** * 添加动态(菜单)路由 * @param {*} menuList 菜单列表 - * @param {*} routes 递归创建的动态(菜单)路由 + * @param {*} routes 递归创建的动态(菜单)路由数组 */ function fnAddDynamicMenuRoutes (menuList = [], routes = []) { - let temp = [] - const modules = import.meta.glob('../views/modules/**/index.vue') + let temp = [] // 临时存储子菜单项 + const modules = import.meta.glob('../views/modules/**/index.vue') // 动态导入视图模块 + + // 遍历菜单列表,创建对应的路由对象 for (let i = 0; i < menuList.length; i++) { if (menuList[i].list && menuList[i].list.length >= 1) { - temp = temp.concat(menuList[i].list) + temp = temp.concat(menuList[i].list) // 如果有子菜单,添加到临时数组 } else if (menuList[i].url && /\S/.test(menuList[i].url)) { - menuList[i].url = menuList[i].url.replace(/^\//, '') + menuList[i].url = menuList[i].url.replace(/^\//, '') // 移除 URL 开头的斜杠 const route = { - path: menuList[i].url, - component: null, - name: menuList[i].url, + path: menuList[i].url, // 路径 + component: null, // 组件 + name: menuList[i].url, // 名称 meta: { - menuId: menuList[i].menuId, - title: menuList[i].name, - isDynamic: true, - isTab: true, - iframeUrl: '' + menuId: menuList[i].menuId, // 菜单项 ID + title: menuList[i].name, // 标题 + isDynamic: true, // 标记为动态路由 + isTab: true, // 标记为标签页 + iframeUrl: '' // iframe URL,默认为空 } } - // url以http[s]://开头, 通过iframe展示 + + // 如果 URL 是有效的 HTTP[S] 地址,则通过 iframe 展示 if (isURL(menuList[i].url)) { - route.path = `i-${menuList[i].menuId}` - route.name = `i-${menuList[i].menuId}` - route.meta.iframeUrl = menuList[i].url + route.path = `i-${menuList[i].menuId}` // 修改路径为 iframe 特定格式 + route.name = `i-${menuList[i].menuId}` // 修改名称为 iframe 特定格式 + route.meta.iframeUrl = menuList[i].url // 设置 iframe URL } else { try { - route.component = modules[`../views/modules/${menuList[i].url}/index.vue`] || null + route.component = modules[`../views/modules/${menuList[i].url}/index.vue`] || null // 动态加载组件 } catch (e) {} } - routes.push(route) + + routes.push(route) // 将路由对象添加到 routes 数组 } } + + // 如果还有子菜单项,递归处理 if (temp.length >= 1) { fnAddDynamicMenuRoutes(temp, routes) } else { - mainRoutes.name = 'main-dynamic' - mainRoutes.children = routes - router.addRoute(mainRoutes) + mainRoutes.name = 'main-dynamic' // 修改主路由名称为 'main-dynamic' + mainRoutes.children = routes // 将动态路由添加为主路由的子路由 + router.addRoute(mainRoutes) // 添加主路由到 Vue Router 实例 } + + // 添加一个通配符路由,处理未匹配的路径,重定向到 404 页面 router.addRoute({ path: '/:pathMatch(.*)*', redirect: { name: '404' } }) } -export default router + +export default router // 导出配置好的 Vue Router 实例 diff --git a/front-end/mall4v/src/stores/common.js b/front-end/mall4v/src/stores/common.js index 72ba4af..26e0878 100644 --- a/front-end/mall4v/src/stores/common.js +++ b/front-end/mall4v/src/stores/common.js @@ -1,80 +1,116 @@ import { defineStore } from 'pinia' import router from '@/router' + +// 定义名为 'common' 的 Pinia Store export const useCommonStore = defineStore('common', { - state: () => { - return { - // 页面文档可视高度(随窗口改变大小) - documentClientHeight: 0, - // 侧边栏, 布局皮肤, light(浅色) / dark(黑色) - sidebarLayoutSkin: 'dark', - // 侧边栏, 折叠状态 - sidebarFold: true, - // 侧边栏, 菜单 - menuList: [], - menuActiveName: '', - // 主入口标签页 - mainTabs: [], - mainTabsActiveName: '', - // 当前选择的标签 - selectMenu: [], - // 路由列表 - routeList: [], - menuIds: [], - selectLeftId: '', - selectRightId: '' - } - }, + // 状态 (state) - 存储应用的数据 + state: () => ({ + // 页面文档可视高度(随窗口改变大小) + documentClientHeight: 0, + // 侧边栏布局皮肤, light(浅色) / dark(黑色) + sidebarLayoutSkin: 'dark', + // 侧边栏折叠状态 + sidebarFold: true, + // 侧边栏菜单列表 + menuList: [], + // 当前激活的菜单名称 + menuActiveName: '', + // 主入口标签页列表 + mainTabs: [], + // 当前激活的主入口标签页名称 + mainTabsActiveName: '', + // 当前选择的标签链(用于面包屑导航) + selectMenu: [], + // 路由列表 + routeList: [], + // 菜单项 ID 列表 + menuIds: [], + // 当前选中的左侧菜单 ID + selectLeftId: '', + // 当前选中的右侧菜单 ID + selectRightId: '' + }), + + // 动作 (actions) - 包含更改状态的逻辑 actions: { - updateDocumentClientHeight (height) { - this.documentClientHeight = height + // 更新页面文档可视高度 + updateDocumentClientHeight(height) { + this.documentClientHeight = height; }, - updateSidebarFold (fold) { - this.sidebarFold = fold + + // 更新侧边栏折叠状态 + updateSidebarFold(fold) { + this.sidebarFold = fold; }, - updateMenuList (list) { - this.menuList = list + + // 更新侧边栏菜单列表 + updateMenuList(list) { + this.menuList = list; }, - updateMenuActiveName (name) { - this.menuActiveName = name + + // 更新当前激活的菜单名称 + updateMenuActiveName(name) { + this.menuActiveName = name; }, - updateMainTabs (tabs) { - this.mainTabs = tabs + + // 更新主入口标签页列表 + updateMainTabs(tabs) { + this.mainTabs = tabs; }, - updateMainTabsActiveName (name) { - this.mainTabsActiveName = name + + // 更新当前激活的主入口标签页名称 + updateMainTabsActiveName(name) { + this.mainTabsActiveName = name; }, - updateRouteList (list) { - this.routeList = list + + // 更新路由列表 + updateRouteList(list) { + this.routeList = list; }, - updateSelectMenu (list) { - this.selectMenu = list + + // 更新当前选择的标签链(用于面包屑导航) + updateSelectMenu(list) { + this.selectMenu = list; }, - updateSelectLeftId (id) { - this.selectLeftId = id + + // 更新当前选中的左侧菜单 ID + updateSelectLeftId(id) { + this.selectLeftId = id; }, - updateSelectRightId (id) { - this.selectRightId = id + + // 更新当前选中的右侧菜单 ID + updateSelectRightId(id) { + this.selectRightId = id; }, - replaceSelectMenu (title) { - this.selectMenu.splice(this.selectMenu.length - 1, 1, title) + + // 替换当前选择的标签链的最后一项 + replaceSelectMenu(title) { + this.selectMenu.splice(this.selectMenu.length - 1, 1, title); }, - updateMenuIds (list) { - this.menuIds = [] + + // 更新菜单项 ID 列表,确保所有 ID 是字符串形式 + updateMenuIds(list) { + this.menuIds = []; list.forEach(menu => { - this.menuIds.push(String(menu.menuId + '')) - }) + this.menuIds.push(String(menu.menuId + '')); + }); }, - removeMainActiveTab () { - this.mainTabs = this.mainTabs.filter(item => item.name !== this.mainTabsActiveName) + + // 移除当前激活的主入口标签页,并处理相关逻辑 + removeMainActiveTab() { + // 过滤掉当前激活的标签页 + this.mainTabs = this.mainTabs.filter(item => item.name !== this.mainTabsActiveName); + if (this.mainTabs.length >= 1) { - // 当前选中tab被删除 + // 如果还有其他标签页,则切换到最后一个标签页 router.push({ name: this.mainTabs[this.mainTabs.length - 1].name }, () => { - this.mainTabsActiveName = this.mainTabs[this.mainTabs.length - 1].name - }) + this.mainTabsActiveName = this.mainTabs[this.mainTabs.length - 1].name; + }); } else { - this.menuActiveName = '' - router.push({ name: 'home' }) + // 如果没有其他标签页,则重置菜单激活名称并跳转到主页 + this.menuActiveName = ''; + router.push({ name: 'home' }); } } } -}) +}); diff --git a/front-end/mall4v/src/stores/prod.js b/front-end/mall4v/src/stores/prod.js index ef07f3c..8112447 100644 --- a/front-end/mall4v/src/stores/prod.js +++ b/front-end/mall4v/src/stores/prod.js @@ -1,37 +1,53 @@ import { defineStore } from 'pinia' + +// 定义名为 'prod' 的 Pinia Store,用于管理商品相关数据和操作 export const scoreProdStore = defineStore('prod', { - state: () => { - return { - id: 0, - skuTags: [], - defalutSku: { - price: 0, // 销售价 - oriPrice: 0, // 市场价 - stocks: 0, // 库存 - properties: '', // 销售属性组合字符串 - skuName: '', // sku名称 - prodName: '', // 商品名称 - weight: 0, // 商品重量 - volume: 0, // 商品体积 - status: 1 // 0 禁用 1 启用 - } + // 状态 (state) - 存储商品相关的数据 + state: () => ({ + id: 0, // 商品 ID + skuTags: [], // SKU 标签列表,每个标签代表一个销售属性(如颜色、尺寸等) + defalutSku: { + price: 0, // 销售价 + oriPrice: 0, // 市场价(原价) + stocks: 0, // 库存数量 + properties: '', // 销售属性组合字符串,例如 "红色;M号" + skuName: '', // SKU 名称,具体到某一销售属性组合的商品名称 + prodName: '', // 商品名称,通用名称 + weight: 0, // 商品重量 + volume: 0, // 商品体积 + status: 1 // SKU 状态,0 表示禁用,1 表示启用 } - }, + }), + + // 动作 (actions) - 包含更改状态的逻辑 actions: { - updateSkuTags (skuTags) { - this.skuTags = skuTags + // 更新 SKU 标签列表 + updateSkuTags(skuTags) { + this.skuTags = skuTags; }, - addSkuTag (skuTag) { - this.skuTags.push(skuTag) + + // 添加新的 SKU 标签 + addSkuTag(skuTag) { + this.skuTags.push(skuTag); }, - removeSkuTag (tagIndex) { - this.skuTags.splice(tagIndex, 1) + + // 移除指定索引的 SKU 标签 + removeSkuTag(tagIndex) { + this.skuTags.splice(tagIndex, 1); }, - removeSkuTagItem (tagIndex, tagItemIndex) { - this.skuTags[tagIndex].tagItems.splice(tagItemIndex, 1) + + // 移除指定 SKU 标签中的某个项 + removeSkuTagItem(tagIndex, tagItemIndex) { + if (this.skuTags[tagIndex] && this.skuTags[tagIndex].tagItems) { + this.skuTags[tagIndex].tagItems.splice(tagItemIndex, 1); + } }, - addSkuTagItem ({ tagIndex, tagItem }) { - this.skuTags[tagIndex].tagItems.push(tagItem) + + // 向指定 SKU 标签中添加新项 + addSkuTagItem({ tagIndex, tagItem }) { + if (this.skuTags[tagIndex] && this.skuTags[tagIndex].tagItems) { + this.skuTags[tagIndex].tagItems.push(tagItem); + } } } -}) +}); diff --git a/front-end/mall4v/src/stores/user.js b/front-end/mall4v/src/stores/user.js index 0af1012..491485f 100644 --- a/front-end/mall4v/src/stores/user.js +++ b/front-end/mall4v/src/stores/user.js @@ -1,29 +1,41 @@ import { defineStore } from 'pinia' + +// 定义名为 'user' 的 Pinia Store,用于管理用户相关数据和操作 export const useUserStore = defineStore('user', { - state: () => { - return { - id: 0, - name: '', - userId: '', - shopId: '', - mobile: '' - } - }, + // 状态 (state) - 存储用户相关的数据 + state: () => ({ + id: 0, // 用户 ID,通常是一个唯一的整数值 + name: '', // 用户名称 + userId: '', // 用户标识符,可能是用户名或系统内部使用的唯一标识 + shopId: '', // 商铺 ID,如果用户关联到特定商铺,则存储该商铺的 ID + mobile: '' // 用户手机号码 + }), + + // 动作 (actions) - 包含更改状态的逻辑 actions: { - updateId (id) { - this.id = id + // 更新用户 ID + updateId(id) { + this.id = id; }, - updateName (name) { - this.name = name + + // 更新用户名称 + updateName(name) { + this.name = name; }, - updateMobile (mobile) { - this.mobile = mobile + + // 更新用户手机号码 + updateMobile(mobile) { + this.mobile = mobile; }, - updateShopId (shopId) { - this.shopId = shopId + + // 更新商铺 ID + updateShopId(shopId) { + this.shopId = shopId; }, - updateUserId (userId) { - this.userId = userId + + // 更新用户标识符 + updateUserId(userId) { + this.userId = userId; } } -}) +}); diff --git a/front-end/mall4v/src/styles/_base.scss b/front-end/mall4v/src/styles/_base.scss index 088920b..2f3686d 100644 --- a/front-end/mall4v/src/styles/_base.scss +++ b/front-end/mall4v/src/styles/_base.scss @@ -1,8 +1,12 @@ +/* + * 全局样式设置 + */ *, *:before, *:after { - box-sizing: border-box; + box-sizing: border-box; /* 确保所有元素的宽度和高度计算包括 padding 和 border */ } + body { font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif; font-size: 14px; @@ -10,23 +14,24 @@ body { color: #303133; background-color: #fff; } + a { - color: mix(#fff, $--color-primary, 20%); + color: mix(#fff, $--color-primary, 20%); /* 链接颜色为白色与主色混合后的20% */ text-decoration: none; + &:focus, &:hover { - color: $--color-primary; + color: $--color-primary; /* 激活或悬停时链接颜色为主色 */ text-decoration: underline; } } + img { - vertical-align: middle; - max-width: 100%; + vertical-align: middle; /* 图片垂直居中对齐 */ + max-width: 100%; /* 确保图片不会超出其容器 */ } - -/* Utils ------------------------------- */ +/* 清除浮动 */ .clearfix:before, .clearfix:after { content: " "; @@ -36,31 +41,21 @@ img { clear: both; } - - - -/* Reset element-ui ------------------------------- */ -.site-wrapper { - .el-pagination { - display: flex; - justify-content: flex-end; - } +/* 重置 element-ui 样式 */ +.site-wrapper .el-pagination { + display: flex; + justify-content: flex-end; /* 分页组件右对齐 */ } - -/* Layout ------------------------------- */ +/* 布局 */ .site-wrapper { position: relative; - min-width: 1180px; + min-width: 1180px; /* 设置最小宽度以确保布局在大屏幕上的稳定性 */ } - -/* Sidebar fold ------------------------------- */ +/* 侧边栏折叠 */ .site-content--tabs { - padding: 60px 20px 20px 20px !important; + padding: 60px 20px 20px 20px !important; /* 当标签页存在时调整内容区的内边距 */ } .site-navbar { color: #333333; @@ -69,37 +64,32 @@ img { .site-navbar__header, .site-navbar__brand, .site-sidebar { - width: 100px; + width: 100px; /* 折叠状态下左侧栏的宽度 */ } .site-navbar__body, .site-content__wrapper { - margin-left: 100px; + margin-left: 100px; /* 折叠后内容区向左偏移量 */ border-bottom: 1px solid #EBEDF0; } - .site-navbar__brand { - &-lg { - display: none; - } - &-mini { - display: inline-block; - } + .site-navbar__brand-lg { + display: none; /* 折叠状态隐藏大尺寸品牌标志 */ + } + .site-navbar__brand-mini { + display: inline-block; /* 显示小尺寸品牌标志 */ } .site-sidebar, .site-sidebar__inner { - overflow: initial; + overflow: initial; /* 解决滚动条显示问题 */ } } -// animation .site-sidebar, .site-sidebar__menu-icon, .site-content__wrapper, .site-content--tabs > .el-tabs .el-tabs__header { - transition: inline-block .3s, left .3s, width .3s, margin-left .3s, font-size .3s; + transition: all .3s ease-in-out; /* 添加过渡效果 */ } - -/* Navbar ------------------------------- */ +/* 导航栏 */ .site-navbar { position: fixed; top: 0; @@ -107,13 +97,10 @@ img { left: 0; z-index: 1030; height: 50px; - // box-shadow: 0 2px 4px rgba(0, 0, 0, .08); background-color: $navbar--background-color; &__header { - position: relative; float: left; - // width: 180px; height: 50px; margin-left: 20px; overflow: hidden; @@ -121,9 +108,7 @@ img { &__brand { display: table-cell; vertical-align: middle; - // width: 230px; height: 50px; - margin: 0; line-height: 50px; font-size: 20px; text-align: center; @@ -151,28 +136,19 @@ img { } &__avatar { border-bottom: none !important; - * { - vertical-align: inherit; - } - .el-dropdown-link { - > img { - width: 36px; - height: auto; - margin-right: 5px; - border-radius: 100%; - vertical-align: middle; - } + .el-dropdown-link img { + width: 36px; + height: auto; + margin-right: 5px; + border-radius: 100%; + vertical-align: middle; } } &__body { - position: relative; - // margin-left: 230px; - // padding-right: 15px; background-color: #fff; } &__menu { float: left; - background-color: transparent; border-bottom: 0; &--right { @@ -185,9 +161,7 @@ img { } } - -/* Sidebar ------------------------------- */ +/* 侧边栏 */ .site-sidebar { position: fixed; top: 50px; @@ -203,14 +177,12 @@ img { } &__inner { position: relative; - z-index: 1; width: 250px; height: 100%; padding-bottom: 15px; overflow-y: scroll; } &__menu.el-menu { - width: 100px; border-right: 0; } &__menu-icon { @@ -222,9 +194,7 @@ img { } } - -/* Content ------------------------------- */ +/* 内容区 */ .site-content { position: relative; padding: 15px; @@ -242,38 +212,31 @@ img { } } - -// 新版规范全局统一样式 -// el-table 表格表头样式 +/* 表格样式 */ .table-header { background-color: #f7f8fa !important; color: #000; height: 60px; } -// el-table 表格行样式 - 多行文本/图文 .table-row { height: 100px; } -// el-table 表格行样式 - 单行文本展示 .table-row-low { height: 65px; } -// el-table 表格单元格样式 .table-cell { padding: 0; } -// 表格文字换行模式 .el-table .cell { line-height: 20px !important; word-break: break-word !important; } -// 表格第一列样式(内容&表头) .el-table tr > td:first-child > .cell, .el-table th:first-child > .cell { padding-left: 20px; } -// 按钮样式 +/* 按钮样式 */ .default-btn { height: 32px; line-height: 32px; @@ -334,7 +297,6 @@ img { cursor: not-allowed; } } -// 相邻按钮样式 .default-btn + .default-btn { margin-left: 10px; } @@ -342,31 +304,26 @@ img { margin-left: 20px; } -// 状态展示 +/* 状态展示 */ .tag-text { font-size: 14px; } -// el-dialog 样式 +/* 对话框样式 */ .el-dialog__header { border-bottom: 1px solid #f0f0f0; margin-right: 0; } - .el-dialog__footer { border-top: 1px solid #f0f0f0; } - -// 列表布局样式 -// 搜索栏 +/* 列表布局样式 */ .search-bar { padding: 25px 20px 0; margin-bottom: 20px; background-color: #F7F8FA; .input-row { - display: block; - // 选择器(下拉框) & 输入框 宽度 .el-form-item .el-form-item__content .el-select, .el-form-item .el-form-item__content .el-input { width: 200px; @@ -382,9 +339,7 @@ img { } } } -// 主体 .main-container { - // 操作按钮 .operation-bar { position: relative; display: flex; @@ -403,7 +358,6 @@ img { font-size: 12px; } } - // 表格 .table-con { margin-top: 20px; padding-bottom: 30px; @@ -412,7 +366,6 @@ img { display: flex; justify-content: center; } - // 图片 + 文本 .table-cell-con { display: flex; align-items: center; @@ -430,17 +383,14 @@ img { margin-left: 8px; flex: 1; text-overflow: ellipsis; - -o-text-overflow: ellipsis; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; - /* autoprefixer: ignore next */ -webkit-box-orient: vertical; overflow: hidden; line-height: 20px; } } - // 纯图片 .table-cell-image { width: 60px; height: 60px; @@ -451,14 +401,11 @@ img { object-fit: contain; } } - // 纯文本 .table-cell-text { text-overflow: ellipsis; - -o-text-overflow: ellipsis; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; - /* autoprefixer: ignore next */ -webkit-box-orient: vertical; overflow: hidden; line-height: 20px; @@ -469,7 +416,7 @@ img { } } -// el-tabs 样式 +/* 标签样式 */ .el-tabs__nav-wrap::after{ height: 1px !important; } @@ -487,12 +434,11 @@ img { border-bottom: 2px solid #155BD4; } -// 新增页面头部标题样式 +/* 新增页面头部标题样式 */ .new-page-title { width: 100%; height: 62px; background: #F7F8FA; - box-sizing: border-box; padding: 19px 20px; display: flex; align-items: center; @@ -514,4 +460,4 @@ img { } .time-select-item { text-align: center; -} \ No newline at end of file +} diff --git a/front-end/mall4v/src/styles/_normalize.scss b/front-end/mall4v/src/styles/_normalize.scss index 7fb5177..bd3b8c3 100644 --- a/front-end/mall4v/src/styles/_normalize.scss +++ b/front-end/mall4v/src/styles/_normalize.scss @@ -4,12 +4,10 @@ ========================================================================== */ /** - * 1. Correct the line height in all browsers. - * 2. Prevent adjustments of font size after orientation changes in - * IE on Windows Phone and in iOS. + * 1. 正确设置所有浏览器中的行高。 + * 2. 防止 Windows Phone IE 和 iOS 中由于方向变化引起的字体大小调整。 */ - - html { +html { line-height: 1.15; /* 1 */ -ms-text-size-adjust: 100%; /* 2 */ -webkit-text-size-adjust: 100%; /* 2 */ @@ -19,17 +17,15 @@ ========================================================================== */ /** - * Remove the margin in all browsers (opinionated). + * 移除所有浏览器中的 body 边距(意见性)。 */ - body { margin: 0; } /** - * Add the correct display in IE 9-. + * 在IE 9-中正确显示这些元素。 */ - article, aside, footer, @@ -40,10 +36,8 @@ section { } /** - * Correct the font size and margin on `h1` elements within `section` and - * `article` contexts in Chrome, Firefox, and Safari. + * 在 Chrome, Firefox, 和 Safari 中,修正 section 和 article 上下文中 h1 元素的字体大小和边距。 */ - h1 { font-size: 2em; margin: 0.67em 0; @@ -53,10 +47,9 @@ h1 { ========================================================================== */ /** - * Add the correct display in IE 9-. - * 1. Add the correct display in IE. + * 在IE 9-中正确显示这些元素。 + * 1. 在IE中正确显示 main 元素。 */ - figcaption, figure, main { /* 1 */ @@ -64,18 +57,16 @@ main { /* 1 */ } /** - * Add the correct margin in IE 8. + * 在IE 8中添加正确的边距。 */ - figure { margin: 1em 40px; } /** - * 1. Add the correct box sizing in Firefox. - * 2. Show the overflow in Edge and IE. + * 1. 在Firefox中正确设置 box-sizing。 + * 2. 在Edge和IE中显示溢出内容。 */ - hr { box-sizing: content-box; /* 1 */ height: 0; /* 1 */ @@ -83,10 +74,9 @@ hr { } /** - * 1. Correct the inheritance and scaling of font size in all browsers. - * 2. Correct the odd `em` font sizing in all browsers. + * 1. 在所有浏览器中正确继承和缩放字体大小。 + * 2. 在所有浏览器中修正奇怪的 em 字体大小。 */ - pre { font-family: monospace, monospace; /* 1 */ font-size: 1em; /* 2 */ @@ -96,47 +86,42 @@ pre { ========================================================================== */ /** - * 1. Remove the gray background on active links in IE 10. - * 2. Remove gaps in links underline in iOS 8+ and Safari 8+. + * 1. 移除IE 10中激活链接的灰色背景。 + * 2. 移除iOS 8+ 和 Safari 8+中链接下划线的间隙。 */ - a { background-color: transparent; /* 1 */ } /** - * 1. Remove the bottom border in Chrome 57- and Firefox 39-. - * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. + * 1. 移除Chrome 57- 和 Firefox 39-中按钮底部的边框。 + * 2. 在Chrome, Edge, IE, Opera, 和 Safari中添加正确的文本装饰。 */ - abbr[title] { border-bottom: none; /* 1 */ text-decoration: underline; /* 2 */ } /** - * Prevent the duplicate application of `bolder` by the next rule in Safari 6. + * 防止Safari 6中 bolder 样式重复应用。 */ - b, strong { font-weight: inherit; } /** - * Add the correct font weight in Chrome, Edge, and Safari. + * 在Chrome, Edge, 和 Safari中添加正确的字体粗细。 */ - b, strong { font-weight: bolder; } /** - * 1. Correct the inheritance and scaling of font size in all browsers. - * 2. Correct the odd `em` font sizing in all browsers. + * 1. 在所有浏览器中正确继承和缩放字体大小。 + * 2. 在所有浏览器中修正奇怪的 em 字体大小。 */ - code, kbd, samp { @@ -145,35 +130,30 @@ samp { } /** - * Add the correct font style in Android 4.3-. + * 在Android 4.3-中添加正确的字体风格。 */ - dfn { font-style: italic; } /** - * Add the correct background and color in IE 9-. + * 在IE 9-中添加正确的背景色和颜色。 */ - mark { background-color: #ff0; color: #000; } /** - * Add the correct font size in all browsers. + * 在所有浏览器中添加正确的字体大小。 */ - small { font-size: 80%; } /** - * Prevent `sub` and `sup` elements from affecting the line height in - * all browsers. + * 防止 sub 和 sup 元素影响所有浏览器中的行高。 */ - sub, sup { font-size: 75%; @@ -194,35 +174,31 @@ sup { ========================================================================== */ /** - * Add the correct display in IE 9-. + * 在IE 9-中正确显示这些元素。 */ - audio, video { display: inline-block; } /** - * Add the correct display in iOS 4-7. + * 在iOS 4-7中正确显示 audio 元素。 */ - audio:not([controls]) { display: none; height: 0; } /** - * Remove the border on images inside links in IE 10-. + * 移除IE 10-中图片内部链接的边框。 */ - img { border-style: none; } /** - * Hide the overflow in IE. + * 在IE中隐藏溢出内容。 */ - svg:not(:root) { overflow: hidden; } @@ -231,10 +207,9 @@ svg:not(:root) { ========================================================================== */ /** - * 1. Change the font styles in all browsers (opinionated). - * 2. Remove the margin in Firefox and Safari. + * 1. 改变所有浏览器中的表单控件字体样式(意见性)。 + * 2. 移除Firefox和Safari中的边距。 */ - button, input, optgroup, @@ -247,42 +222,38 @@ textarea { } /** - * Show the overflow in IE. - * 1. Show the overflow in Edge. + * 在IE中显示溢出内容。 + * 1. 在Edge中显示溢出内容。 */ - button, input { /* 1 */ overflow: visible; } /** - * Remove the inheritance of text transform in Edge, Firefox, and IE. - * 1. Remove the inheritance of text transform in Firefox. + * 移除Edge, Firefox, 和 IE中 text-transform 的继承。 + * 1. 移除Firefox中的 text-transform 继承。 */ - button, select { /* 1 */ text-transform: none; } /** - * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video` - * controls in Android 4. - * 2. Correct the inability to style clickable types in iOS and Safari. + * 1. 防止WebKit中的 bug,该bug会破坏 Android 4 中 native `audio` 和 `video` 控件。 + * 2. 修正iOS和Safari中无法对可点击类型进行样式的错误。 */ - button, html [type="button"], /* 1 */ [type="reset"], +[type="reset"], [type="submit"] { -webkit-appearance: button; /* 2 */ } /** - * Remove the inner border and padding in Firefox. + * 移除Firefox中按钮和输入框聚焦时的内边距和边框。 */ - button::-moz-focus-inner, [type="button"]::-moz-focus-inner, [type="reset"]::-moz-focus-inner, @@ -292,9 +263,8 @@ button::-moz-focus-inner, } /** - * Restore the focus styles unset by the previous rule. + * 恢复Firefox中被上一条规则移除的聚焦样式。 */ - button:-moz-focusring, [type="button"]:-moz-focusring, [type="reset"]:-moz-focusring, @@ -303,20 +273,17 @@ button:-moz-focusring, } /** - * Correct the padding in Firefox. + * 在Firefox中修正 fieldset 的内边距。 */ - fieldset { padding: 0.35em 0.75em 0.625em; } /** - * 1. Correct the text wrapping in Edge and IE. - * 2. Correct the color inheritance from `fieldset` elements in IE. - * 3. Remove the padding so developers are not caught out when they zero out - * `fieldset` elements in all browsers. + * 1. 在Edge和IE中修正文本换行。 + * 2. 在IE中修正颜色继承自 fieldset 元素的问题。 + * 3. 移除内边距,以防止开发者在所有浏览器中将 fieldset 元素置零时遇到问题。 */ - legend { box-sizing: border-box; /* 1 */ color: inherit; /* 2 */ @@ -327,28 +294,25 @@ legend { } /** - * 1. Add the correct display in IE 9-. - * 2. Add the correct vertical alignment in Chrome, Firefox, and Opera. + * 1. 在IE 9-中正确显示 progress 元素。 + * 2. 在Chrome, Firefox, 和 Opera中正确设置垂直对齐。 */ - progress { display: inline-block; /* 1 */ vertical-align: baseline; /* 2 */ } /** - * Remove the default vertical scrollbar in IE. + * 移除IE中的默认垂直滚动条。 */ - textarea { overflow: auto; } /** - * 1. Add the correct box sizing in IE 10-. - * 2. Remove the padding in IE 10-. + * 1. 在IE 10-中正确设置 box-sizing。 + * 2. 在IE 10-中移除内边距。 */ - [type="checkbox"], [type="radio"] { box-sizing: border-box; /* 1 */ @@ -356,38 +320,34 @@ textarea { } /** - * Correct the cursor style of increment and decrement buttons in Chrome. + * 在Chrome中修正数字输入框中的上下箭头的高度。 */ - [type="number"]::-webkit-inner-spin-button, [type="number"]::-webkit-outer-spin-button { height: auto; } /** - * 1. Correct the odd appearance in Chrome and Safari. - * 2. Correct the outline style in Safari. + * 1. 修正Chrome和Safari中搜索框的奇怪外观。 + * 2. 修正Safari中搜索框的轮廓样式。 */ - [type="search"] { -webkit-appearance: textfield; /* 1 */ outline-offset: -2px; /* 2 */ } /** - * Remove the inner padding and cancel buttons in Chrome and Safari on macOS. + * 移除macOS版Chrome和Safari中搜索框的内部填充和取消按钮。 */ - [type="search"]::-webkit-search-cancel-button, [type="search"]::-webkit-search-decoration { -webkit-appearance: none; } /** - * 1. Correct the inability to style clickable types in iOS and Safari. - * 2. Change font properties to `inherit` in Safari. + * 1. 修正iOS和Safari中无法对可点击类型进行样式的错误。 + * 2. 将字体属性更改为 inherit 以适应 Safari。 */ - ::-webkit-file-upload-button { -webkit-appearance: button; /* 1 */ font: inherit; /* 2 */ @@ -396,20 +356,18 @@ textarea { /* Interactive ========================================================================== */ -/* - * Add the correct display in IE 9-. - * 1. Add the correct display in Edge, IE, and Firefox. +/** + * 添加在IE 9-中正确显示的细节元素。 + * 1. 在Edge, IE, 和 Firefox中正确显示菜单元素。 */ - details, /* 1 */ menu { display: block; } -/* - * Add the correct display in all browsers. +/** + * 在所有浏览器中正确显示 summary 元素。 */ - summary { display: list-item; } @@ -418,17 +376,15 @@ summary { ========================================================================== */ /** - * Add the correct display in IE 9-. + * 在IE 9-中正确显示 canvas 元素。 */ - canvas { display: inline-block; } /** - * Add the correct display in IE. + * 在IE中正确显示 template 元素。 */ - template { display: none; } @@ -437,9 +393,8 @@ template { ========================================================================== */ /** - * Add the correct display in IE 10-. + * 在IE 10-中正确显示 [hidden] 属性。 */ - [hidden] { display: none; -} \ No newline at end of file +} diff --git a/front-end/mall4v/src/styles/_variables.scss b/front-end/mall4v/src/styles/_variables.scss index 4518fa2..a4aaf3a 100644 --- a/front-end/mall4v/src/styles/_variables.scss +++ b/front-end/mall4v/src/styles/_variables.scss @@ -1,14 +1,36 @@ - -// css 变量 +// 定义全局颜色变量 +// --color-primary: 主要颜色,用于强调或突出显示重要元素 $--color-primary: #155BD4; -// Navbar +// Navbar (导航栏) 样式 +// 设置导航栏的背景色为主颜色 $navbar--background-color: $--color-primary; -// Sidebar +// Sidebar (侧边栏) 样式 +// 设置侧边栏深色背景色 $sidebar--background-color-dark: #263238; +// 设置侧边栏文字颜色为浅灰色,适合深色背景 $sidebar--color-text-dark: #8a979e; -// Content +// Content (内容区) 样式 +// 设置主要内容区域的背景色为淡灰白色,提供舒适的阅读体验 $content--background-color: #f1f4f5; +/* 下面是使用上述变量的实际CSS规则示例 */ + +/* 导航栏 */ +.navbar { + background-color: $navbar--background-color; // 使用主要颜色作为导航栏背景 +} + +/* 侧边栏 */ +.sidebar { + background-color: $sidebar--background-color-dark; // 使用深色作为侧边栏背景 + color: $sidebar--color-text-dark; // 使用浅灰色作为侧边栏文本颜色 +} + +/* 内容区 */ +.content { + background-color: $content--background-color; // 使用淡灰白色作为内容区背景 +} + diff --git a/front-end/mall4v/src/styles/element-variables.scss b/front-end/mall4v/src/styles/element-variables.scss index 25c0681..87bd68e 100644 --- a/front-end/mall4v/src/styles/element-variables.scss +++ b/front-end/mall4v/src/styles/element-variables.scss @@ -1,7 +1,33 @@ -// element-plus :root { + /* + * 定义全局 CSS 变量,这些变量可以在整个项目中被引用。 + */ + + /* + * --el-color-primary: 主要颜色,用于强调或突出显示重要元素, + * 如按钮、链接等交互性元素的颜色。这个颜色应该在整个应用中保持一致, + * 以提供统一的视觉体验。 + */ --el-color-primary: #155BD4; + + /* + * --el-color-primary-light-3: 较浅的主要颜色变体,通常用作主要颜色的替代, + * 比如在悬停状态、激活状态或者需要稍微减弱视觉重量的地方。 + * 这个值可以用来创建一个从主要颜色到更浅色调的过渡效果。 + */ --el-color-primary-light-3: #447cdd; + + /* + * --el-menu-item-height: 设置菜单项的高度,默认为40px。 + * 这个高度适用于Element Plus的菜单组件中的顶级菜单项。 + * 确保所有菜单项有相同的高度,有助于保持界面的一致性和美观性。 + */ --el-menu-item-height: 40px; + + /* + * --el-menu-sub-item-height: 设置子菜单项的高度,默认为40px。 + * 类似于菜单项的高度,但专门用于菜单的子级项目。 + * 保持与父级菜单项相同或不同的高度,取决于设计需求。 + */ --el-menu-sub-item-height: 40px; } diff --git a/front-end/mall4v/src/styles/index.scss b/front-end/mall4v/src/styles/index.scss index 526a674..5fac76c 100644 --- a/front-end/mall4v/src/styles/index.scss +++ b/front-end/mall4v/src/styles/index.scss @@ -1,8 +1,27 @@ -@import "_normalize"; // api: https://github.com/necolas/normalize.css/ +// 引入 normalize.css 样式库 +// api: https://github.com/necolas/normalize.css/ +// normalize.css 是一个CSS库,它的目的是通过提供一组样式来标准化不同浏览器的默认样式, +// 确保网页在各种浏览器中看起来一致。此文件应该放在所有其他样式之前引入,以确保其样式可以被正确覆盖。 +@import "_normalize"; + +// 引入变量文件 +// _variables 文件通常包含了项目中使用的全局变量定义,如颜色、字体大小、间距等。 +// 这些变量可以在整个项目中重复使用,以便于维护和统一设计语言。 @import "_variables"; + +// 引入基础样式文件 +// _base 文件一般包含项目的通用样式,如重置样式(reset)、排版样式(typography)、布局样式(layout)等。 +// 它为网站提供了一套基础的样式规范,确保页面元素具有一致的表现。 @import "_base"; + +// 引入 Element Plus 的变量文件 +// 此文件包含了 Element Plus 组件库所用的颜色、尺寸等变量定义。 +// 通过覆盖这些变量,可以在不修改组件库源码的情况下,定制化Element Plus组件的外观。 @import "@/styles/element-variables.scss"; +// 自定义样式规则:设置错误消息的 z-index +// .element-error-message-zindex 类用于提高特定元素的堆叠顺序(z-index),确保该元素始终显示在其他内容之上。 +// 在这里,我们给这个类设置了 z-index 为 3000,并且使用了 !important 关键字来确保这条规则不会被其他样式覆盖。 .element-error-message-zindex { - z-index:3000 !important; + z-index: 3000 !important; }