fix(popconfirm): icon slot not working

This commit is contained in:
07akioni 2021-06-11 17:26:42 +08:00
parent ed51570bd2
commit c179c3a665
3 changed files with 9 additions and 7 deletions

View File

@ -7,6 +7,7 @@
- Fix `n-button` causes crash when it's imported in script inside head tag. [#68](https://github.com/TuSimple/naive-ui/pull/68)
- Fix `n-spin` animation shifts.
- Fix `n-menu` lack `on-update-value` and `on-update-expanded-keys` props.
- Fix `n-popconfirm` icon slot not working.
## 2.11.5 (2021-06-10)

View File

@ -7,6 +7,7 @@
- 修正 `n-button` 在 head 内部的 script 被引入造成崩溃 [#68](https://github.com/TuSimple/naive-ui/pull/68)
- 修正 `n-spin` 动画闪烁
- 修正 `n-menu` 缺少 `on-update-value``on-update-expanded-keys` 属性
- 修正 `n-popconfirm` icon slot 不生效
## 2.11.5 (2021-06-10)

View File

@ -72,32 +72,32 @@ export default defineComponent({
}
},
render () {
const { mergedClsPrefix } = this
const { mergedClsPrefix, $slots } = this
return (
<div style={this.cssVars as CSSProperties}>
<div class={`${mergedClsPrefix}-popconfirm__body`}>
{this.showIcon ? (
<div class={`${mergedClsPrefix}-popconfirm__icon`}>
<slot name="icon">
{renderSlot($slots, 'icon', undefined, () => [
<NBaseIcon clsPrefix={mergedClsPrefix}>
{{ default: () => <WarningIcon /> }}
</NBaseIcon>
</slot>
])}
</div>
) : null}
{renderSlot(this.$slots, 'default')}
{renderSlot($slots, 'default')}
</div>
<div class={`${mergedClsPrefix}-popconfirm__action`}>
{renderSlot(this.$slots, 'action', undefined, () => [
{renderSlot($slots, 'action', undefined, () => [
<NButton size="small" onClick={this.handleNegativeClick}>
{this.localizedNegativeText}
{{ default: () => this.localizedNegativeText }}
</NButton>,
<NButton
size="small"
type="primary"
onClick={this.handlePositiveClick}
>
{this.localizedPositiveText}
{{ default: () => this.localizedPositiveText }}
</NButton>
])}
</div>