From a2f03be92a5d70f4d943e66774ad0e2f525a53af Mon Sep 17 00:00:00 2001 From: bastarder Date: Thu, 20 Aug 2020 16:28:07 +0800 Subject: [PATCH] feat(tabs): Fix lint error --- packages/tabs/doc/basic.vue | 4 ++-- packages/tabs/src/tab-bar.vue | 2 +- packages/tabs/src/tab-nav.vue | 8 ++++---- packages/tabs/src/tabs.vue | 12 ++++++------ 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/tabs/doc/basic.vue b/packages/tabs/doc/basic.vue index e005a95425..db457545b2 100644 --- a/packages/tabs/doc/basic.vue +++ b/packages/tabs/doc/basic.vue @@ -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, ) } }, diff --git a/packages/tabs/src/tab-bar.vue b/packages/tabs/src/tab-bar.vue index 0c4856a518..faf13dfb5e 100644 --- a/packages/tabs/src/tab-bar.vue +++ b/packages/tabs/src/tab-bar.vue @@ -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) { diff --git a/packages/tabs/src/tab-nav.vue b/packages/tabs/src/tab-nav.vue index d584d168f0..0cc2b51e58 100644 --- a/packages/tabs/src/tab-nav.vue +++ b/packages/tabs/src/tab-nav.vue @@ -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], ) diff --git a/packages/tabs/src/tabs.vue b/packages/tabs/src/tabs.vue index ad097014c3..ced4a7f3e1 100644 --- a/packages/tabs/src/tabs.vue +++ b/packages/tabs/src/tabs.vue @@ -41,11 +41,11 @@ export default defineComponent({ const panes = ref([]) 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