优化一些代码

This commit is contained in:
izory
2021-09-06 15:56:53 +08:00
parent 8be3046ae2
commit f112d6a992
13 changed files with 47 additions and 136 deletions

View File

@@ -1,12 +1,11 @@
<template>
<el-dropdown trigger="click" @command="handleSetSize">
<div>
<div style="line-height: 50px">
<svg-icon class-name="size-icon" icon-class="size" />
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="item of sizeOptions" :key="item.value" :disabled="size===item.value" :command="item.value">
{{
item.label }}
{{item.label }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
@@ -17,41 +16,40 @@ export default {
data() {
return {
sizeOptions: [
{ label: 'Default', value: 'default' },
{ label: 'Medium', value: 'medium' },
{ label: 'Small', value: 'small' },
{ label: 'Mini', value: 'mini' }
]
}
{ label: "Default", value: "default" },
{ label: "Medium", value: "medium" },
{ label: "Small", value: "small" },
{ label: "Mini", value: "mini" },
],
};
},
computed: {
size() {
return this.$store.getters.size
}
return this.$store.getters.size;
},
},
methods: {
handleSetSize(size) {
this.$ELEMENT.size = size
this.$store.dispatch('app/setSize', size)
this.refreshView()
this.$ELEMENT.size = size;
this.$store.dispatch("app/setSize", size);
this.refreshView();
this.$message({
message: 'Switch Size Success',
type: 'success'
})
message: "Switch Size Success",
type: "success",
});
},
refreshView() {
// In order to make the cached page re-rendered
this.$store.dispatch('tagsView/delAllCachedViews', this.$route)
this.$store.dispatch("tagsView/delAllCachedViews", this.$route);
const { fullPath } = this.$route
const { fullPath } = this.$route;
this.$nextTick(() => {
this.$router.replace({
path: '/redirect' + fullPath
})
})
}
}
}
path: "/redirect" + fullPath,
});
});
},
},
};
</script>

View File

@@ -14,9 +14,9 @@
<template v-if="device!=='mobile'">
<search id="header-search" class="right-menu-item" />
<screenfull id="screenfull" class="right-menu-item hover-effect" />
<el-tooltip content="布局大小" effect="dark" placement="bottom">
<!-- <el-tooltip content="布局大小" effect="dark" placement="bottom"> -->
<size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip>
<!-- </el-tooltip> -->
</template>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">

View File

@@ -48,7 +48,12 @@
<el-table-column prop="path" label="路由地址" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="component" label="组件路径" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="visible" label="显示" :formatter="visibleFormat" width="70"></el-table-column>
<el-table-column prop="status" label="状态" :formatter="statusFormat" width="70"></el-table-column>
<el-table-column prop="status" label="状态" width="70">
<template slot-scope="scope">
<el-tag v-if="scope.row.status === '0'" >正常</el-tag>
<el-tag type="warning" v-else >停用</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:menu:edit']">修改</el-button>