Skip to content

Commit

Permalink
feat: 🎸 初版完成
Browse files Browse the repository at this point in the history
  • Loading branch information
kailong321200875 committed Dec 31, 2020
1 parent 37ec378 commit 5bfe4d2
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 13 deletions.
7 changes: 6 additions & 1 deletion src/components/Dialog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

<!-- 弹窗内容 -->
<el-scrollbar class="com-dialog__content">
<slot />
<div class="content__wrap">
<slot />
</div>
</el-scrollbar>

<template v-if="slots.footer" #footer>
Expand Down Expand Up @@ -40,6 +42,9 @@ export default defineComponent({

<style lang="less" scoped>
.com-dialog__content {
.content__wrap {
padding-right: 10px;
}
@{deep}(.el-scrollbar__wrap ) {
max-height: 600px; // 最大高度
overflow-x: hidden; // 隐藏横向滚动栏
Expand Down
2 changes: 1 addition & 1 deletion src/components/Echart/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default defineComponent({
}
}, 100);
(window as any).addEventListener('resize', __resizeHandler)
sidebarElm = document.getElementsByClassName('sidebar-container-wrap')[0]
sidebarElm = document.getElementsByClassName('sidebar__wrap')[0]
sidebarElm && sidebarElm.addEventListener('transitionend', sidebarResizeHandler)
})
Expand Down
13 changes: 12 additions & 1 deletion src/components/Setting/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@
<el-switch v-model="greyMode" @change="setGreyMode" />
</div>

<div class="setting__item">
<span>回到顶部</span>
<el-switch v-model="showBackTop" @change="setShowBackTop" />
</div>

<div class="setting__item">
<span>页面标题</span>
<el-input v-model="title" size="mini" @change="setTitle" />
Expand Down Expand Up @@ -169,6 +174,11 @@ export default defineComponent({
appStore.SetGreyMode(greyMode)
}
const showBackTop = ref<boolean>(appStore.showBackTop)
function setShowBackTop(showBackTop: boolean) {
appStore.SetShowBackTop(showBackTop)
}
return {
drawer, toggleClick,
layout, setLayout,
Expand All @@ -182,7 +192,8 @@ export default defineComponent({
logo, setLogo,
title, setTitle,
logoTitle, setLogoTitle,
greyMode, setGreyMode
greyMode, setGreyMode,
showBackTop, setShowBackTop
}
}
})
Expand Down
2 changes: 1 addition & 1 deletion src/components/Table/components/Slot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default defineComponent({
return h('span', _this.slots[props.slotName]({
row: props.row,
column: props.column,
index: props.index
$index: props.index
}))
}
})
Expand Down
1 change: 0 additions & 1 deletion src/pages/index/axios-config/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const service: AxiosInstance = axios.create({
// request拦截器
service.interceptors.request.use(
(config: AxiosRequestConfig) => {
console.log(config)
if (config.method === 'post' && config.headers['Content-Type'] === 'application/x-www-form-urlencoded') {
config.data = qs.stringify(config.data)
}
Expand Down
10 changes: 9 additions & 1 deletion src/pages/index/layout/modules/Classic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@
<!-- setting -->
<setting />
<!-- setting -->

<el-backtop
v-if="showBackTop"
target=".main__wrap--content .el-scrollbar__wrap"
:bottom="100"
/>
</div>
</template>

Expand Down Expand Up @@ -106,6 +112,7 @@ export default defineComponent({
// const fixedNavbar = computed(() => appStore.fixedNavbar)
// const fixedTags = computed(() => appStore.fixedTags)
const fixedHeader = computed(() => appStore.fixedHeader)
const showBackTop = computed(() => appStore.showBackTop)
const classObj = computed(() => {
const obj = {}
Expand All @@ -131,7 +138,8 @@ export default defineComponent({
fixedHeader,
// fixedNavbar,
// fixedTags,
setCollapsed
setCollapsed,
showBackTop
}
}
})
Expand Down
10 changes: 9 additions & 1 deletion src/pages/index/layout/modules/LeftTop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
<!-- setting -->
<setting />
<!-- setting -->

<el-backtop
v-if="showBackTop"
target=".main__wrap--content .el-scrollbar__wrap"
:bottom="100"
/>
</div>
</template>

Expand Down Expand Up @@ -127,6 +133,7 @@ export default defineComponent({
// const fixedNavbar = computed(() => appStore.fixedNavbar)
// const fixedTags = computed(() => appStore.fixedTags)
const fixedHeader = computed(() => appStore.fixedHeader)
const showBackTop = computed(() => appStore.showBackTop)
const classObj = computed(() => {
const obj = {}
Expand All @@ -152,7 +159,8 @@ export default defineComponent({
fixedHeader,
// fixedNavbar,
// fixedTags,
setCollapsed
setCollapsed,
showBackTop
}
}
})
Expand Down
10 changes: 9 additions & 1 deletion src/pages/index/layout/modules/Top.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@
<!-- setting -->
<setting />
<!-- setting -->

<el-backtop
v-if="showBackTop"
target=".main__wrap--content .el-scrollbar__wrap"
:bottom="100"
/>
</div>
</template>

Expand Down Expand Up @@ -114,6 +120,7 @@ export default defineComponent({
// const fixedNavbar = computed(() => appStore.fixedNavbar)
// const fixedTags = computed(() => appStore.fixedTags)
const fixedHeader = computed(() => appStore.fixedHeader)
const showBackTop = computed(() => appStore.showBackTop)
const classObj = computed(() => {
const obj = {}
Expand All @@ -139,7 +146,8 @@ export default defineComponent({
fixedHeader,
// fixedNavbar,
// fixedTags,
setCollapsed
setCollapsed,
showBackTop
}
}
})
Expand Down
1 change: 1 addition & 0 deletions src/pages/index/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ export const asyncRouterMap: AppRouteRecordRaw[] = [
path: '/example-demo',
component: Layout,
name: 'ExampleDemo',
redirect: '/example-demo/example-dialog',
meta: {
alwaysShow: true,
icon: 'example',
Expand Down
10 changes: 10 additions & 0 deletions src/pages/index/store/modules/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface AppState {
logoTitle: String
userInfo: String
greyMode: Boolean
showBackTop: Boolean
}

@Module({ dynamic: true, namespaced: true, store, name: 'app' })
Expand All @@ -34,6 +35,7 @@ class App extends VuexModule implements AppState {
public logoTitle = 'vue-ElPlus-admin' // logo标题
public userInfo = 'userInfo' // 登录信息存储字段-建议每个项目换一个字段,避免与其他项目冲突
public greyMode = false // 是否开始灰色模式,用于特殊悼念日
public showBackTop = true // 是否显示回到顶部

@Mutation
private SET_COLLAPSED(collapsed: boolean): void {
Expand Down Expand Up @@ -87,6 +89,10 @@ class App extends VuexModule implements AppState {
private SET_GREYMODE(greyMode: boolean): void {
this.greyMode = greyMode
}
@Mutation
private SET_SHOWBACKTOP(showBackTop: boolean): void {
this.showBackTop = showBackTop
}

@Action
public SetCollapsed(collapsed: boolean): void {
Expand Down Expand Up @@ -140,6 +146,10 @@ class App extends VuexModule implements AppState {
public SetGreyMode(greyMode: boolean): void {
this.SET_GREYMODE(greyMode)
}
@Action
public SetShowBackTop(showBackTop: boolean): void {
this.SET_SHOWBACKTOP(showBackTop)
}
}

export const appStore = getModule<App>(App)
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export default defineComponent({
if (type === 'add') {
currentChange(1)
}
close()
toggleVisible()
getExampleList()
}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/index/views/table-demo/screen-table/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<com-table
ref="filterTable"
v-loading="loading"
row-field="date"
row-key="date"
:columns="columns"
:data="tableData"
:default-sort="{prop: 'date', order: 'descending'}"
Expand Down Expand Up @@ -70,7 +70,7 @@ export default defineComponent({
label: '日期',
sortable: true,
width: '180',
columnfield: 'date',
columnKey: 'date',
filters: [{ text: '2016-05-01', value: '2016-05-01' }, { text: '2016-05-02', value: '2016-05-02' }, { text: '2016-05-03', value: '2016-05-03' }, { text: '2016-05-04', value: '2016-05-04' }],
filterMethod: filterHandler
},
Expand Down
4 changes: 2 additions & 2 deletions src/pages/index/views/table-demo/tree-and-load/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
v-loading="loading"
:columns="columns"
:data="tableData"
row-field="id"
row-key="id"
border
default-expand-all
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
Expand All @@ -21,7 +21,7 @@
v-loading="loading"
:columns="columns1"
:data="tableData1"
row-field="id"
row-key="id"
border
lazy
:load="load"
Expand Down

0 comments on commit 5bfe4d2

Please sign in to comment.