feat: 🎸 初版完成

This commit is contained in:
chenkl 2020-12-31 15:20:32 +08:00
parent 37ec378f0b
commit 5bfe4d236f
13 changed files with 63 additions and 13 deletions

View File

@ -11,7 +11,9 @@
<!-- 弹窗内容 --> <!-- 弹窗内容 -->
<el-scrollbar class="com-dialog__content"> <el-scrollbar class="com-dialog__content">
<div class="content__wrap">
<slot /> <slot />
</div>
</el-scrollbar> </el-scrollbar>
<template v-if="slots.footer" #footer> <template v-if="slots.footer" #footer>
@ -40,6 +42,9 @@ export default defineComponent({
<style lang="less" scoped> <style lang="less" scoped>
.com-dialog__content { .com-dialog__content {
.content__wrap {
padding-right: 10px;
}
@{deep}(.el-scrollbar__wrap ) { @{deep}(.el-scrollbar__wrap ) {
max-height: 600px; // max-height: 600px; //
overflow-x: hidden; // overflow-x: hidden; //

View File

@ -62,7 +62,7 @@ export default defineComponent({
} }
}, 100); }, 100);
(window as any).addEventListener('resize', __resizeHandler) (window as any).addEventListener('resize', __resizeHandler)
sidebarElm = document.getElementsByClassName('sidebar-container-wrap')[0] sidebarElm = document.getElementsByClassName('sidebar__wrap')[0]
sidebarElm && sidebarElm.addEventListener('transitionend', sidebarResizeHandler) sidebarElm && sidebarElm.addEventListener('transitionend', sidebarResizeHandler)
}) })

View File

@ -82,6 +82,11 @@
<el-switch v-model="greyMode" @change="setGreyMode" /> <el-switch v-model="greyMode" @change="setGreyMode" />
</div> </div>
<div class="setting__item">
<span>回到顶部</span>
<el-switch v-model="showBackTop" @change="setShowBackTop" />
</div>
<div class="setting__item"> <div class="setting__item">
<span>页面标题</span> <span>页面标题</span>
<el-input v-model="title" size="mini" @change="setTitle" /> <el-input v-model="title" size="mini" @change="setTitle" />
@ -169,6 +174,11 @@ export default defineComponent({
appStore.SetGreyMode(greyMode) appStore.SetGreyMode(greyMode)
} }
const showBackTop = ref<boolean>(appStore.showBackTop)
function setShowBackTop(showBackTop: boolean) {
appStore.SetShowBackTop(showBackTop)
}
return { return {
drawer, toggleClick, drawer, toggleClick,
layout, setLayout, layout, setLayout,
@ -182,7 +192,8 @@ export default defineComponent({
logo, setLogo, logo, setLogo,
title, setTitle, title, setTitle,
logoTitle, setLogoTitle, logoTitle, setLogoTitle,
greyMode, setGreyMode greyMode, setGreyMode,
showBackTop, setShowBackTop
} }
} }
}) })

View File

@ -25,7 +25,7 @@ export default defineComponent({
return h('span', _this.slots[props.slotName]({ return h('span', _this.slots[props.slotName]({
row: props.row, row: props.row,
column: props.column, column: props.column,
index: props.index $index: props.index
})) }))
} }
}) })

View File

@ -19,7 +19,6 @@ const service: AxiosInstance = axios.create({
// request拦截器 // request拦截器
service.interceptors.request.use( service.interceptors.request.use(
(config: AxiosRequestConfig) => { (config: AxiosRequestConfig) => {
console.log(config)
if (config.method === 'post' && config.headers['Content-Type'] === 'application/x-www-form-urlencoded') { if (config.method === 'post' && config.headers['Content-Type'] === 'application/x-www-form-urlencoded') {
config.data = qs.stringify(config.data) config.data = qs.stringify(config.data)
} }

View File

@ -63,6 +63,12 @@
<!-- setting --> <!-- setting -->
<setting /> <setting />
<!-- setting --> <!-- setting -->
<el-backtop
v-if="showBackTop"
target=".main__wrap--content .el-scrollbar__wrap"
:bottom="100"
/>
</div> </div>
</template> </template>
@ -106,6 +112,7 @@ export default defineComponent({
// const fixedNavbar = computed(() => appStore.fixedNavbar) // const fixedNavbar = computed(() => appStore.fixedNavbar)
// const fixedTags = computed(() => appStore.fixedTags) // const fixedTags = computed(() => appStore.fixedTags)
const fixedHeader = computed(() => appStore.fixedHeader) const fixedHeader = computed(() => appStore.fixedHeader)
const showBackTop = computed(() => appStore.showBackTop)
const classObj = computed(() => { const classObj = computed(() => {
const obj = {} const obj = {}
@ -131,7 +138,8 @@ export default defineComponent({
fixedHeader, fixedHeader,
// fixedNavbar, // fixedNavbar,
// fixedTags, // fixedTags,
setCollapsed setCollapsed,
showBackTop
} }
} }
}) })

View File

@ -84,6 +84,12 @@
<!-- setting --> <!-- setting -->
<setting /> <setting />
<!-- setting --> <!-- setting -->
<el-backtop
v-if="showBackTop"
target=".main__wrap--content .el-scrollbar__wrap"
:bottom="100"
/>
</div> </div>
</template> </template>
@ -127,6 +133,7 @@ export default defineComponent({
// const fixedNavbar = computed(() => appStore.fixedNavbar) // const fixedNavbar = computed(() => appStore.fixedNavbar)
// const fixedTags = computed(() => appStore.fixedTags) // const fixedTags = computed(() => appStore.fixedTags)
const fixedHeader = computed(() => appStore.fixedHeader) const fixedHeader = computed(() => appStore.fixedHeader)
const showBackTop = computed(() => appStore.showBackTop)
const classObj = computed(() => { const classObj = computed(() => {
const obj = {} const obj = {}
@ -152,7 +159,8 @@ export default defineComponent({
fixedHeader, fixedHeader,
// fixedNavbar, // fixedNavbar,
// fixedTags, // fixedTags,
setCollapsed setCollapsed,
showBackTop
} }
} }
}) })

View File

@ -71,6 +71,12 @@
<!-- setting --> <!-- setting -->
<setting /> <setting />
<!-- setting --> <!-- setting -->
<el-backtop
v-if="showBackTop"
target=".main__wrap--content .el-scrollbar__wrap"
:bottom="100"
/>
</div> </div>
</template> </template>
@ -114,6 +120,7 @@ export default defineComponent({
// const fixedNavbar = computed(() => appStore.fixedNavbar) // const fixedNavbar = computed(() => appStore.fixedNavbar)
// const fixedTags = computed(() => appStore.fixedTags) // const fixedTags = computed(() => appStore.fixedTags)
const fixedHeader = computed(() => appStore.fixedHeader) const fixedHeader = computed(() => appStore.fixedHeader)
const showBackTop = computed(() => appStore.showBackTop)
const classObj = computed(() => { const classObj = computed(() => {
const obj = {} const obj = {}
@ -139,7 +146,8 @@ export default defineComponent({
fixedHeader, fixedHeader,
// fixedNavbar, // fixedNavbar,
// fixedTags, // fixedTags,
setCollapsed setCollapsed,
showBackTop
} }
} }
}) })

View File

@ -510,6 +510,7 @@ export const asyncRouterMap: AppRouteRecordRaw[] = [
path: '/example-demo', path: '/example-demo',
component: Layout, component: Layout,
name: 'ExampleDemo', name: 'ExampleDemo',
redirect: '/example-demo/example-dialog',
meta: { meta: {
alwaysShow: true, alwaysShow: true,
icon: 'example', icon: 'example',

View File

@ -16,6 +16,7 @@ export interface AppState {
logoTitle: String logoTitle: String
userInfo: String userInfo: String
greyMode: Boolean greyMode: Boolean
showBackTop: Boolean
} }
@Module({ dynamic: true, namespaced: true, store, name: 'app' }) @Module({ dynamic: true, namespaced: true, store, name: 'app' })
@ -34,6 +35,7 @@ class App extends VuexModule implements AppState {
public logoTitle = 'vue-ElPlus-admin' // logo标题 public logoTitle = 'vue-ElPlus-admin' // logo标题
public userInfo = 'userInfo' // 登录信息存储字段-建议每个项目换一个字段,避免与其他项目冲突 public userInfo = 'userInfo' // 登录信息存储字段-建议每个项目换一个字段,避免与其他项目冲突
public greyMode = false // 是否开始灰色模式,用于特殊悼念日 public greyMode = false // 是否开始灰色模式,用于特殊悼念日
public showBackTop = true // 是否显示回到顶部
@Mutation @Mutation
private SET_COLLAPSED(collapsed: boolean): void { private SET_COLLAPSED(collapsed: boolean): void {
@ -87,6 +89,10 @@ class App extends VuexModule implements AppState {
private SET_GREYMODE(greyMode: boolean): void { private SET_GREYMODE(greyMode: boolean): void {
this.greyMode = greyMode this.greyMode = greyMode
} }
@Mutation
private SET_SHOWBACKTOP(showBackTop: boolean): void {
this.showBackTop = showBackTop
}
@Action @Action
public SetCollapsed(collapsed: boolean): void { public SetCollapsed(collapsed: boolean): void {
@ -140,6 +146,10 @@ class App extends VuexModule implements AppState {
public SetGreyMode(greyMode: boolean): void { public SetGreyMode(greyMode: boolean): void {
this.SET_GREYMODE(greyMode) this.SET_GREYMODE(greyMode)
} }
@Action
public SetShowBackTop(showBackTop: boolean): void {
this.SET_SHOWBACKTOP(showBackTop)
}
} }
export const appStore = getModule<App>(App) export const appStore = getModule<App>(App)

View File

@ -225,7 +225,7 @@ export default defineComponent({
if (type === 'add') { if (type === 'add') {
currentChange(1) currentChange(1)
} }
close() toggleVisible()
getExampleList() getExampleList()
} }

View File

@ -12,7 +12,7 @@
<com-table <com-table
ref="filterTable" ref="filterTable"
v-loading="loading" v-loading="loading"
row-field="date" row-key="date"
:columns="columns" :columns="columns"
:data="tableData" :data="tableData"
:default-sort="{prop: 'date', order: 'descending'}" :default-sort="{prop: 'date', order: 'descending'}"
@ -70,7 +70,7 @@ export default defineComponent({
label: '日期', label: '日期',
sortable: true, sortable: true,
width: '180', 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' }], 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 filterMethod: filterHandler
}, },

View File

@ -11,7 +11,7 @@
v-loading="loading" v-loading="loading"
:columns="columns" :columns="columns"
:data="tableData" :data="tableData"
row-field="id" row-key="id"
border border
default-expand-all default-expand-all
:tree-props="{children: 'children', hasChildren: 'hasChildren'}" :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
@ -21,7 +21,7 @@
v-loading="loading" v-loading="loading"
:columns="columns1" :columns="columns1"
:data="tableData1" :data="tableData1"
row-field="id" row-key="id"
border border
lazy lazy
:load="load" :load="load"