Skip to content

Commit

Permalink
fix(tabs): scroll shadow is not updated when it's resized, closes #1224
Browse files Browse the repository at this point in the history
  • Loading branch information
07akioni committed Sep 27, 2021
1 parent dbdac7e commit b39a798
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Fix `n-data-table` ellipsis not show when last column not set ellipsis, closes [#934](https://github.com/TuSimple/naive-ui/issues/934).
- Fix `n-grid-item` won't work with responsive config.
- Fix `n-tabs`'s scroll shadow is not updated when it's resized, closes [#1224](https://github.com/TuSimple/naive-ui/issues/1224).

### Feats

Expand Down
5 changes: 3 additions & 2 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

### Fixes

- Fix `n-data-table` 当最后一列未设置 `ellipsis` 时省略失效,关闭 [#934](https://github.com/TuSimple/naive-ui/issues/934)
- Fix `n-grid-item` 响应式不生效
- 修复 `n-data-table` 当最后一列未设置 `ellipsis` 时省略失效,关闭 [#934](https://github.com/TuSimple/naive-ui/issues/934)
- 修复 `n-grid-item` 响应式不生效
- 修复 `n-tabs` 在尺寸改变后没有更新滚动阴影状态,关闭 [#1224](https://github.com/TuSimple/naive-ui/issues/1224)

### Feats

Expand Down
1 change: 1 addition & 0 deletions src/tabs/demos/zhCN/index.demo-entry.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ display-directive
addable
line-debug
style-inherit-debug
shadow-debug
```

## API
Expand Down
40 changes: 40 additions & 0 deletions src/tabs/demos/zhCN/shadow-debug.demo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Shadow Debug

`#1224`

```html
<div :class="getClass">
<n-button @click="() => (getClass = 'half')">half</n-button>
<n-button @click="() => (getClass = 'full')">full</n-button>
<n-tabs v-model:value="value" type="card" tab-style="min-width: 100px;">
<n-tab-pane v-for="panel in panels" :name="panel" :key="panel">
{{ panel }}
</n-tab-pane>
<template #prefix>Prefix</template>
<template #suffix>Suffix</template>
</n-tabs>
</div>
```

```js
import { defineComponent, ref } from 'vue'

export default defineComponent({
setup () {
const valueRef = ref(1)
const panelsRef = ref([1, 2, 3])

return {
value: valueRef,
panels: panelsRef,
getClass: ref('half')
}
}
})
```

```css
.half {
width: 50%;
}
```
4 changes: 3 additions & 1 deletion src/tabs/src/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,11 @@ export default defineComponent({
updateCurrentBarStyle()
// here we don't need to force layout after update bar style
// since deriveScrollShadow will force layout
deriveScrollShadow(xScrollInstRef.value?.$el)
barEl.classList.remove(disableTransitionClassName)
}
if (type !== 'segment') {
deriveScrollShadow(xScrollInstRef.value?.$el)
}
}, 64)

const addTabFixedRef = ref(false)
Expand Down

0 comments on commit b39a798

Please sign in to comment.