mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-01 10:47:57 +08:00
feat(tabs): Fix lint error
This commit is contained in:
parent
18aa2638f6
commit
a2f03be92a
@ -218,7 +218,7 @@ export default {
|
||||
})
|
||||
}
|
||||
this.editableTabsValue = activeName
|
||||
this.editableTabs = tabs.filter((tab) => tab.name !== targetName)
|
||||
this.editableTabs = tabs.filter(tab => tab.name !== targetName)
|
||||
},
|
||||
handleTabsEdit(targetName, action) {
|
||||
if (action === 'add') {
|
||||
@ -245,7 +245,7 @@ export default {
|
||||
}
|
||||
this.editableTabsValue = activeName
|
||||
this.editableTabs = tabs.filter(
|
||||
(tab) => tab.name !== targetName,
|
||||
tab => tab.name !== targetName,
|
||||
)
|
||||
}
|
||||
},
|
||||
|
@ -31,7 +31,7 @@ export default defineComponent({
|
||||
const sizeName = ['top', 'bottom'].includes(rootTabs.props.tabPosition) ? 'width' : 'height'
|
||||
const sizeDir = sizeName === 'width' ? 'x' : 'y'
|
||||
|
||||
props.tabs.every((tab) => {
|
||||
props.tabs.every(tab => {
|
||||
let $el = instance.parent.refs?.[`tab-${tab.setupState.paneName}`]
|
||||
if (!$el) { return false }
|
||||
if (!tab.setupState.active) {
|
||||
|
@ -143,7 +143,7 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
const changeTab = (e) => {
|
||||
const changeTab = e => {
|
||||
const keyCode = e.keyCode
|
||||
let nextIndex
|
||||
let currentIndex, tabList
|
||||
@ -301,7 +301,7 @@ export default defineComponent({
|
||||
'span',
|
||||
{
|
||||
class: 'el-icon-close',
|
||||
onClick: (ev) => { onTabRemove(pane, ev) },
|
||||
onClick: ev => { onTabRemove(pane, ev) },
|
||||
},
|
||||
) : null
|
||||
|
||||
@ -328,8 +328,8 @@ export default defineComponent({
|
||||
tabindex: tabindex,
|
||||
onFocus: () => { setFocus() },
|
||||
onBlur: () => { removeFocus() },
|
||||
onClick: (ev) => { removeFocus(); onTabClick(pane, tabName, ev) },
|
||||
onKeydown: (ev) => { if (closable && (ev.keyCode === 46 || ev.keyCode === 8)) { onTabRemove(pane, ev)} },
|
||||
onClick: ev => { removeFocus(); onTabClick(pane, tabName, ev) },
|
||||
onKeydown: ev => { if (closable && (ev.keyCode === 46 || ev.keyCode === 8)) { onTabRemove(pane, ev)} },
|
||||
},
|
||||
[tabLabelContent, btnClose],
|
||||
)
|
||||
|
@ -41,11 +41,11 @@ export default defineComponent({
|
||||
const panes = ref<ComponentInternalInstance[]>([])
|
||||
const instance = getCurrentInstance()
|
||||
|
||||
watch(() => props.activeName, (modelValue) => {
|
||||
watch(() => props.activeName, modelValue => {
|
||||
setCurrentName(modelValue)
|
||||
})
|
||||
|
||||
watch(() => props.modelValue, (modelValue) => {
|
||||
watch(() => props.modelValue, modelValue => {
|
||||
setCurrentName(modelValue)
|
||||
})
|
||||
|
||||
@ -61,7 +61,7 @@ export default defineComponent({
|
||||
})
|
||||
|
||||
const getPaneInstanceFromSlot = (vnode, paneInstanceList = []) => {
|
||||
[...(vnode.children || [])].forEach((node) => {
|
||||
[...(vnode.children || [])].forEach(node => {
|
||||
let type = node.type
|
||||
type = type.name || type
|
||||
if (type === 'ElTabPane' && node.component) {
|
||||
@ -94,13 +94,13 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
const changeCurrentName = (value) => {
|
||||
const changeCurrentName = value => {
|
||||
currentName.value = value
|
||||
ctx.emit('input', value)
|
||||
ctx.emit('update:modelValue', value)
|
||||
}
|
||||
|
||||
const setCurrentName = (value) => {
|
||||
const setCurrentName = value => {
|
||||
if(currentName.value !== value && props.beforeLeave) {
|
||||
const before = props.beforeLeave(value, currentName.value)
|
||||
if(before && before.then) {
|
||||
@ -177,7 +177,7 @@ export default defineComponent({
|
||||
class: 'el-tabs__new-tab',
|
||||
tabindex: '0',
|
||||
onClick: handleTabAdd,
|
||||
onKeydown: (ev) => { if (ev.keyCode === 13) { handleTabAdd() }},
|
||||
onKeydown: ev => { if (ev.keyCode === 13) { handleTabAdd() }},
|
||||
},
|
||||
[h('i', { class: 'el-icon-plus' })],
|
||||
) : null
|
||||
|
Loading…
Reference in New Issue
Block a user