Skip to content

Commit 2a1ca35

Browse files
committed
🎨 优化下菜单 title 过长时的显示问题
1 parent 6ae51cd commit 2a1ca35

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

src/views/system/menu/SysMenuPage.vue

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
type="primary"
5252
icon="plus"
5353
@click="handleAdd()"
54-
>新建 </a-button>
54+
>新建
55+
</a-button>
5556
</div>
5657
</div>
5758

@@ -72,7 +73,12 @@
7273
>
7374
<template #menu-title-slot="text, record">
7475
<icon-font v-if="record.icon" :type="record.icon" style="margin-right: 6px" />
75-
{{ enableI18n ? record.i18nTitle : record.title }}
76+
<a-tooltip placement="top">
77+
<template slot="title">
78+
<span>{{ enableI18n ? record.i18nTitle : record.title }}</span>
79+
</template>
80+
{{ enableI18n ? record.i18nTitle : record.title }}
81+
</a-tooltip>
7682
<a-icon
7783
v-if="enableI18n && record.type !== 2"
7884
type="edit"
@@ -115,7 +121,7 @@ export default {
115121
name: 'SysMenuPage',
116122
components: { SysMenuModalForm, I18nMessageModal },
117123
mixins: [TablePageMixin],
118-
data() {
124+
data () {
119125
return {
120126
delObj: delObj,
121127
@@ -129,6 +135,7 @@ export default {
129135
title: '菜单名称',
130136
dataIndex: 'title',
131137
width: 200,
138+
ellipsis: true,
132139
scopedSlots: { customRender: 'menu-title-slot' }
133140
},
134141
{
@@ -182,17 +189,17 @@ export default {
182189
menuList: []
183190
}
184191
},
185-
created() {
192+
created () {
186193
this.loadData()
187194
// 开启国际化时,注册监听事件
188195
this.enableI18n && this.$bus.$on('switch-language', this.reloadTable)
189196
},
190-
destroyed() {
197+
destroyed () {
191198
// 销毁监听事件
192199
this.enableI18n && this.$bus.$off('switch-language', this.reloadTable)
193200
},
194201
methods: {
195-
loadData() {
202+
loadData () {
196203
this.loading = true
197204
list(this.queryParam)
198205
.then(res => {
@@ -204,13 +211,13 @@ export default {
204211
this.loading = false
205212
})
206213
},
207-
reloadTable() {
214+
reloadTable () {
208215
this.loadData()
209216
},
210217
/**
211218
* 新建菜单权限
212219
*/
213-
handleAdd(record) {
220+
handleAdd (record) {
214221
const attributes = { title: '新建菜单权限' }
215222
// 按钮类型不允许有子级,所以默认变成创建平级
216223
if (record) {
@@ -229,20 +236,20 @@ export default {
229236
* 编辑菜单权限
230237
* @param record 当前菜单权限属性
231238
*/
232-
handleEdit(record) {
239+
handleEdit (record) {
233240
const attributes = { title: '编辑菜单权限' }
234241
this.$refs.formModal.update(record, attributes)
235242
},
236243
/**
237244
* 打开 i18nMessage 弹窗
238245
*/
239-
openI18nMessage(code) {
246+
openI18nMessage (code) {
240247
this.$refs.i18nMessageModal.show(code)
241248
},
242249
/**
243250
* 当 i18nData 有修改时,刷新表格数据
244251
*/
245-
handleI18nMessageUpdate() {
252+
handleI18nMessageUpdate () {
246253
this.reloadTable()
247254
}
248255
}

0 commit comments

Comments
 (0)