mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 12:01:57 +08:00
fix: Tab name style. (#1003)
* fix: Tab name style. * fix tooltip text.
This commit is contained in:
parent
17103e32a4
commit
eac099ad7a
@ -20,24 +20,32 @@
|
|||||||
<span v-if="isFirstTab" key="withTooltip">
|
<span v-if="isFirstTab" key="withTooltip">
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
v-if="isFirstTab"
|
v-if="isFirstTab"
|
||||||
:content="isLocked ? $t('data.lockRecord') : $t('data.unlockRecord')"
|
:content="tooltipText"
|
||||||
placement="top"
|
placement="top"
|
||||||
>
|
>
|
||||||
<el-button type="text" @click="lockRecord()">
|
<el-button type="text" @click="lockRecord()">
|
||||||
<i
|
<i
|
||||||
:class="isLocked ? 'el-icon-lock' : 'el-icon-unlock'"
|
:class="{ 'el-icon-lock': isLocked, 'el-icon-unlock': !isLocked }"
|
||||||
style="font-size: 15px; color: black;"
|
style="font-size: 15px; color: black;"
|
||||||
/>
|
/>
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
|
||||||
<span :style="isLocked ? 'color: red;' :'color: #1890ff;'">
|
<slot name="prefix" />
|
||||||
|
|
||||||
|
<span :class="{ 'locked-record': isLocked }">
|
||||||
{{ tabName }}
|
{{ tabName }}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
<slot name="sufix" />
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span v-else key="onlyName">
|
<span v-else key="onlyName">
|
||||||
|
<slot name="prefix" />
|
||||||
|
|
||||||
{{ tabName }}
|
{{ tabName }}
|
||||||
|
|
||||||
|
<slot name="sufix" />
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -80,6 +88,13 @@ export default defineComponent({
|
|||||||
return !root.isEmptyValue(recordUuid) && recordUuid !== 'create-new'
|
return !root.isEmptyValue(recordUuid) && recordUuid !== 'create-new'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const tooltipText = computed(() => {
|
||||||
|
if (isLocked.value) {
|
||||||
|
return root.$t('data.unlockRecord')
|
||||||
|
}
|
||||||
|
return root.$t('data.lockRecord')
|
||||||
|
})
|
||||||
|
|
||||||
const lockRecord = () => {
|
const lockRecord = () => {
|
||||||
const action = isLocked.value ? 'unlockRecord' : 'lockRecord'
|
const action = isLocked.value ? 'unlockRecord' : 'lockRecord'
|
||||||
const { recordId, recordUuid } = getRecordId()
|
const { recordId, recordUuid } = getRecordId()
|
||||||
@ -168,9 +183,16 @@ export default defineComponent({
|
|||||||
isLocked,
|
isLocked,
|
||||||
// computed
|
// computed
|
||||||
isFirstTab,
|
isFirstTab,
|
||||||
|
tooltipText,
|
||||||
// methods
|
// methods
|
||||||
lockRecord
|
lockRecord
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.locked-record {
|
||||||
|
color: red !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user