Default Changelist

feature/qzw
秦泽旺 3 months ago
parent 9fbe2efbb6
commit 52954f1563

@ -24,43 +24,58 @@
</div>
</template>
-->
<script>
export default {
//
name: 'MultiTab',
//
data () {
return {
fullPathList: [],
pages: [],
activeKey: '',
newTabIndex: 0
fullPathList: [], //
pages: [], // Vue
activeKey: '', // key
newTabIndex: 0 // 使
}
},
//
created () {
// pagesfullPathList
this.pages.push(this.$route)
this.fullPathList.push(this.$route.fullPath)
//
this.selectedLastPath()
},
methods: {
// action
onEdit (targetKey, action) {
this[action](targetKey)
},
// pagesfullPathList
remove (targetKey) {
//
this.pages = this.pages.filter(page => page.fullPath !== targetKey)
this.fullPathList = this.fullPathList.filter(path => path !== targetKey)
//
//
if (!this.fullPathList.includes(this.activeKey)) {
this.selectedLastPath()
}
},
//
selectedLastPath () {
this.activeKey = this.fullPathList[this.fullPathList.length - 1]
},
// content menu
//
closeThat (e) {
this.remove(e)
},
//
closeLeft (e) {
const currentIndex = this.fullPathList.indexOf(e)
if (currentIndex > 0) {
@ -73,6 +88,8 @@ export default {
this.$message.info('左侧没有标签')
}
},
//
closeRight (e) {
const currentIndex = this.fullPathList.indexOf(e)
if (currentIndex < (this.fullPathList.length - 1)) {
@ -85,6 +102,8 @@ export default {
this.$message.info('右侧没有标签')
}
},
//
closeAll (e) {
const currentIndex = this.fullPathList.indexOf(e)
this.fullPathList.forEach((item, index) => {
@ -93,6 +112,8 @@ export default {
}
})
},
//
closeMenuClick ({ key, item, domEvent }) {
const vkey = domEvent.target.getAttribute('data-vkey')
switch (key) {
@ -111,6 +132,8 @@ export default {
break
}
},
//
renderTabPaneMenu (e) {
return (
<a-menu {...{ on: { click: this.closeMenuClick } }}>
@ -121,7 +144,8 @@ export default {
</a-menu>
)
},
// render
//
renderTabPane (title, keyPath) {
const menu = this.renderTabPaneMenu(keyPath)
@ -132,18 +156,26 @@ export default {
)
}
},
//
watch: {
'$route': function (newVal) {
//
this.activeKey = newVal.fullPath
// fullPathList
if (this.fullPathList.indexOf(newVal.fullPath) < 0) {
this.fullPathList.push(newVal.fullPath)
this.pages.push(newVal)
}
},
// activeKey
activeKey: function (newPathKey) {
this.$router.push({ path: newPathKey })
}
},
//
render () {
const { onEdit, $data: { pages } } = this
const panes = pages.map(page => {
@ -160,16 +192,16 @@ export default {
<div class="ant-pro-multi-tab">
<div class="ant-pro-multi-tab-wrapper">
<a-tabs
hideAdd
type={'editable-card'}
v-model={this.activeKey}
tabBarStyle={{ background: '#FFF', margin: 0, paddingLeft: '16px', paddingTop: '1px' }}
{...{ on: { edit: onEdit } }}>
{panes}
hideAdd //
type={'editable-card'} //
v-model={this.activeKey} //
tabBarStyle={{ background: '#FFF', margin: 0, paddingLeft: '16px', paddingTop: '1px' }} //
{...{ on: { edit: onEdit } }}> //
{panes} //
</a-tabs>
</div>
</div>
)
}
}
</script>
</script>

@ -1,4 +1,9 @@
import MultiTab from './MultiTab'
import './index.less'
// 导入名为 MultiTab 的Vue组件该组件定义在当前目录下的 MultiTab.vue 文件中
import MultiTab from './MultiTab';
export default MultiTab
// 导入index.less样式表文件用于为MultiTab组件提供样式定义
import './index.less';
// 将导入的 MultiTab 组件设置为默认导出
// 这样其他文件就可以通过 import MultiTab 来使用这个组件
export default MultiTab;

@ -1,25 +1,34 @@
// 导入外部样式表,可能是包含通用样式或变量定义的文件
@import '../index';
// 定义多标签组件的前缀类用于构建CSS选择器
@multi-tab-prefix-cls: ~"@{ant-pro-prefix}-multi-tab";
@multi-tab-wrapper-prefix-cls: ~"@{ant-pro-prefix}-multi-tab-wrapper";
/*
* 定义多标签组件在.topmenu类下的样式
* 设置最大宽度为1200px
* 设置左右边距,左边距为-23px右边距为24px自动居中
*/
.topmenu .@{multi-tab-prefix-cls} {
max-width: 1200px;
margin: -23px auto 24px auto;
}
*/
// 为多标签组件设置通用样式
.@{multi-tab-prefix-cls} {
margin: -23px -24px 24px -24px;
background: #fff;
margin: -23px -24px 24px -24px; // 设置四个方向的边距
background: #fff; // 背景颜色为白色
}
// 定义多标签组件在.topmenu类下的多标签包装器的样式
.topmenu .@{multi-tab-wrapper-prefix-cls} {
max-width: 1200px;
margin: 0 auto;
max-width: 1200px; // 最大宽度为1200px
margin: 0 auto; // 水平居中对齐
}
// 当内容宽度是流体布局时设置多标签包装器的最大宽度为100%
.topmenu.content-width-Fluid .@{multi-tab-wrapper-prefix-cls} {
max-width: 100%;
margin: 0 auto;
}
max-width: 100%; // 最大宽度为100%
margin: 0 auto; // 水平居中对齐
}

@ -1,4 +1,5 @@
<template>
<!-- 使用 a-popover 组件创建一个弹出框以下是对其配置属性的设置 -->
<a-popover
v-model="visible"
trigger="click"
@ -8,13 +9,21 @@
:arrowPointAtCenter="true"
:overlayStyle="{ width: '300px', top: '50px' }"
>
<!-- 定义弹出框内容的插槽 -->
<template slot="content">
<!-- 使用 a-spin 组件根据 loadding 变量的值来显示加载状态 -->
<a-spin :spinning="loadding">
<!-- 使用 a-tabs 组件创建选项卡 -->
<a-tabs>
<!-- 第一个选项卡通知的配置 -->
<a-tab-pane tab="通知" key="1">
<!-- 使用 a-list 组件创建列表 -->
<a-list>
<!-- 列表中的一个列表项 -->
<a-list-item>
<!-- a-list-item-meta 用于展示列表项中的元信息如标题描述等 -->
<a-list-item-meta title="你收到了 14 份新周报" description="一年前">
<!-- 使用 a-avatar 组件展示头像设置了背景色和头像图片来源 -->
<a-avatar style="background-color: white" slot="avatar" src="https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png"/>
</a-list-item-meta>
</a-list-item>
@ -30,17 +39,22 @@
</a-list-item>
</a-list>
</a-tab-pane>
<!-- 第二个选项卡消息的配置内容暂时为简单文本123 -->
<a-tab-pane tab="消息" key="2">
123
</a-tab-pane>
<!-- 第三个选项卡待办的配置内容暂时为简单文本123 -->
<a-tab-pane tab="待办" key="3">
123
</a-tab-pane>
</a-tabs>
</a-spin>
</template>
<!-- 点击此元素会触发 fetchNotice 方法同时添加了 header-notice 类名 -->
<span @click="fetchNotice" class="header-notice">
<!-- 使用 a-badge 组件展示一个带有数字的徽标这里数字为 12 -->
<a-badge count="12">
<!-- 使用 a-icon 组件展示一个铃铛图标设置了字体大小和内边距 -->
<a-icon style="font-size: 16px; padding: 4px" type="bell" />
</a-badge>
</span>
@ -52,38 +66,48 @@ export default {
name: 'HeaderNotice',
data () {
return {
// loadding false
loadding: false,
// visible a-popover false
visible: false
}
},
methods: {
fetchNotice () {
fetchNotice() {
//
if (!this.visible) {
this.loadding = true
// loadding true
this.loadding = true;
// loadding false
setTimeout(() => {
this.loadding = false
}, 2000)
this.loadding = false;
}, 2000);
} else {
this.loadding = false
// loadding false
this.loadding = false;
}
this.visible = !this.visible
//
this.visible = !this.visible;
}
}
}
</script>
<style lang="css">
.header-notice-wrapper {
top: 50px !important;
}
/* 针对类名为 header-notice-wrapper 的元素设置样式,强制将 top 值设为 50px覆盖可能存在的其他样式 */
.header-notice-wrapper {
top: 50px !important;
}
</style>
<style lang="less" scoped>
.header-notice{
display: inline-block;
transition: all 0.3s;
/* 对类名为 header-notice 的元素设置样式,使其显示为内联块元素,并设置过渡效果 */
.header-notice {
display: inline-block;
transition: all 0.3s;
span {
vertical-align: initial;
}
span {
// span
vertical-align: initial;
}
</style>
}
</style>

@ -1,2 +1,10 @@
// 从当前目录下的'./NoticeIcon'文件中导入名为NoticeIcon的模块或组件。
// './NoticeIcon'指的是与当前文件同一目录下的NoticeIcon文件可能是一个React组件
// 这里的导入路径是相对于当前文件的相对路径。
import NoticeIcon from './NoticeIcon'
export default NoticeIcon
// 导出NoticeIcon模块或组件使得其他文件可以通过import语句来引用它。
// 使用export default语法表示默认导出这意味着在导入时不需要使用花括号{}。
// 这使得其他文件可以通过类似import SomeName from './path/to/this/file'的方式导入NoticeIcon
// 其中SomeName可以是任意名称但导入的内容将是这里导出的NoticeIcon。
export default NoticeIcon

@ -1,27 +1,41 @@
<template>
<!-- 创建一个带有 page-header 类名的 div 容器作为页面头部的外层包裹元素 -->
<div class="page-header">
<!-- 创建一个带有 page-header-index-wide 类名的 div 容器可能用于页面头部的特定布局或样式控制 -->
<div class="page-header-index-wide">
<!-- 使用 s-breadcrumb 组件可能用于展示面包屑导航具体功能取决于该组件的实现 -->
<s-breadcrumb />
<!-- 创建一个名为 detail div 容器用于放置页面头部更详细的内容 -->
<div class="detail">
<!-- 条件判断如果路由元信息中的 hiddenHeaderContent false则展示以下内容 -->
<div class="main" v-if="!$route.meta.hiddenHeaderContent">
<!-- 创建一个 row 类名的 div 容器可能用于布局类似行的概念 -->
<div class="row">
<!-- 如果 logo 属性有值则展示对应的图片图片的源地址由 logo 属性绑定并且添加 logo 类名用于样式控制 -->
<img v-if="logo" :src="logo" class="logo"/>
<!-- 如果 title 属性有值则展示对应的标题内容使用双大括号进行数据绑定展示 title 属性的值并添加 title 类名用于样式控制 -->
<h1 v-if="title" class="title">{{ title }}</h1>
<!-- 创建一个名为 action div 容器用于放置具名插槽内容可能是一些操作按钮之类的元素 -->
<div class="action">
<slot name="action"></slot>
</div>
</div>
<!-- 再创建一个 row 类名的 div 容器继续放置页面头部的其他元素 -->
<div class="row">
<!-- 如果 avatar 属性有值则展示对应的头像元素使用 a-avatar 组件展示图片源地址由 avatar 属性绑定 -->
<div v-if="avatar" class="avatar">
<a-avatar :src="avatar" />
</div>
<!-- 如果有名为 content 的插槽内容则展示对应的插槽内容并添加 headerContent 类名用于样式控制 -->
<div v-if="this.$slots.content" class="headerContent">
<slot name="content"></slot>
</div>
<!-- 如果有名为 extra 的插槽内容则展示对应的插槽内容并添加 extra 类名用于样式控制 -->
<div v-if="this.$slots.extra" class="extra">
<slot name="extra"></slot>
</div>
</div>
<!-- 放置一个用于名为 pageMenu 的插槽内容的容器可能用于展示页面相关的菜单选项等 -->
<div>
<slot name="pageMenu"></slot>
</div>
@ -32,24 +46,29 @@
</template>
<script>
// '../../components/tools/Breadcrumb' Breadcrumb
import Breadcrumb from '../../components/tools/Breadcrumb'
export default {
name: 'PageHeader',
components: {
// Breadcrumb s-breadcrumb 便使
's-breadcrumb': Breadcrumb
},
props: {
// title true
title: {
type: [String, Boolean],
default: true,
required: false
},
// logo
logo: {
type: String,
default: '',
required: false
},
// avatar
avatar: {
type: String,
default: '',
@ -63,89 +82,131 @@ export default {
</script>
<style lang="less" scoped>
// page-header
.page-header {
//
background: #fff;
// 16px 32px 0
padding: 16px 32px 0;
// 1px#e8e8e8
border-bottom: 1px solid #e8e8e8;
.breadcrumb {
// 16px
margin-bottom: 16px;
}
.detail {
// 便
display: flex;
/*margin-bottom: 16px;*/
.avatar {
// 72px
flex: 0 1 72px;
// 24px 8px
margin: 0 24px 8px 0;
& > span {
// 72px使
border-radius: 72px;
//
display: block;
// 72px
width: 72px;
// 72px
height: 72px;
}
}
.main {
//
width: 100%;
//
flex: 0 1 auto;
.row {
// 便
display: flex;
//
width: 100%;
.avatar {
// 16px
margin-bottom: 16px;
}
}
.title {
// 20px
font-size: 20px;
// 500
font-weight: 500;
font-size: 20px;
line-height: 28px;
font-weight: 500;
// rgba
color: rgba(0, 0, 0, 0.85);
// 16px
margin-bottom: 16px;
//
flex: auto;
}
.logo {
// 28px
width: 28px;
// 28px
height: 28px;
// 4px
border-radius: 4px;
// 16px
margin-right: 16px;
}
.content,
.headerContent {
//
flex: auto;
// rgba
color: rgba(0, 0, 0, 0.45);
// 22px
line-height: 22px;
.link {
// 16px
margin-top: 16px;
// 24px
line-height: 24px;
a {
// 14px
font-size: 14px;
// 32px
margin-right: 32px;
}
}
}
.extra {
//
flex: 0 1 auto;
// 88px
margin-left: 88px;
// 242px
min-width: 242px;
//
text-align: right;
}
.action {
// 56px
margin-left: 56px;
// 266px
min-width: 266px;
//
flex: 0 1 auto;
//
text-align: right;
&:empty {
//
display: none;
}
}
@ -153,50 +214,69 @@ export default {
}
}
.mobile .page-header {
// mobile page-header
.mobile.page-header {
.main {
.row {
//
flex-wrap: wrap;
.avatar {
//
flex: 0 1 25%;
// 2% 8px
margin: 0 2% 8px 0;
}
.content,
.headerContent {
//
flex: 0 1 70%;
.link {
// 16px
margin-top: 16px;
// 24px
line-height: 24px;
a {
// 14px
font-size: 14px;
// 10px
margin-right: 10px;
}
}
}
.extra {
// 使
flex: 1 1 auto;
//
margin-left: 0;
// 0
min-width: 0;
//
text-align: right;
}
.action {
//
margin-left: unset;
// 266px
min-width: 266px;
//
flex: 0 1 auto;
//
text-align: left;
// 12px
margin-bottom: 12px;
&:empty {
//
display: none;
}
}
}
}
}
</style>
</style>

@ -1,2 +1,5 @@
import PageHeader from './PageHeader'
export default PageHeader
// 从当前目录下的 PageHeader 文件(通常是.js、.vue等相关的模块文件具体取决于项目配置中导入 PageHeader 模块(可能是一个组件、函数或者类等,具体要看 PageHeader 文件中导出的内容是什么)
import PageHeader from './PageHeader';
// 将导入的 PageHeader 模块原样导出,这样在其他模块中可以通过相应的导入语句引入这个 PageHeader方便复用该模块所代表的功能或组件等内容
export default PageHeader;
Loading…
Cancel
Save