✨(all): update
This commit is contained in:
parent
b704f90fe7
commit
044fff8d6e
@ -61,7 +61,6 @@ const active = computed({
|
||||
});
|
||||
|
||||
const change = function (id: any) {
|
||||
// 回调切换标签之前的回调钩子函数,只要不是return false, 则进行切换该tab
|
||||
if (props.beforeLeave && props.beforeLeave(id) === false) {
|
||||
return;
|
||||
}
|
||||
@ -70,17 +69,12 @@ const change = function (id: any) {
|
||||
};
|
||||
|
||||
const close = function (index: number, id: any) {
|
||||
// 回调关闭之前的回调函数,只要不是return false, 则进行关闭该tab
|
||||
if (props.beforeClose && props.beforeClose(id) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 删除当前tab
|
||||
childrens.value.splice(index, 1);
|
||||
// 点击的是当前激活的tab,则需要切换到下一个tab
|
||||
if (active.value === id) {
|
||||
const nextChildren =
|
||||
childrens.value[index === childrens.value.length ? 0 : index];
|
||||
const nextChildren = childrens.value[index === childrens.value.length ? 0 : index];
|
||||
change(nextChildren && nextChildren.props ? nextChildren.props.id : "");
|
||||
}
|
||||
emit("close", id);
|
||||
@ -89,7 +83,7 @@ const close = function (index: number, id: any) {
|
||||
watch(slotsChange, function () {
|
||||
childrens.value = [];
|
||||
setItemInstanceBySlot((slot.default && slot.default()) as VNode[]);
|
||||
});
|
||||
}, { immediate: true });
|
||||
|
||||
provide("active", active);
|
||||
provide("slotsChange", slotsChange);
|
||||
@ -102,7 +96,6 @@ provide("slotsChange", slotsChange);
|
||||
type ? 'layui-tab-' + type : '',
|
||||
props.tabPosition ? `is-${tabPosition}` : '',
|
||||
]"
|
||||
v-if="active"
|
||||
>
|
||||
<div
|
||||
:class="['layui-tab-head', props.tabPosition ? `is-${tabPosition}` : '']"
|
||||
@ -115,20 +108,19 @@ provide("slotsChange", slotsChange);
|
||||
>
|
||||
<li
|
||||
v-for="(children, index) in childrens"
|
||||
:key="children"
|
||||
:class="[children.props.id === active ? 'layui-this' : '']"
|
||||
@click.stop="change(children.props.id)"
|
||||
:key="children.props?.id"
|
||||
:class="[children.props?.id === active ? 'layui-this' : '']"
|
||||
@click.stop="change(children.props?.id)"
|
||||
>
|
||||
{{ children.props.title }}
|
||||
{{ children.props?.title }}
|
||||
<i
|
||||
v-if="allowClose && children.props.closable != false"
|
||||
v-if="allowClose && children.props?.closable != false"
|
||||
class="layui-icon layui-icon-close layui-unselect layui-tab-close"
|
||||
@click.stop="close(index, children.props.id)"
|
||||
@click.stop="close(index, children.props?.id)"
|
||||
></i>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="layui-tab-content">
|
||||
<slot></slot>
|
||||
</div>
|
||||
|
@ -8,11 +8,23 @@
|
||||
</lay-timeline>
|
||||
|
||||
::: demo
|
||||
|
||||
<template>
|
||||
<lay-timeline>
|
||||
<a href>前往查看</a>
|
||||
</lay-timeline>
|
||||
<lay-timeline>
|
||||
<lay-timeline-item title="1.1.x">
|
||||
<ul>
|
||||
<a name="1-1-3"></a>
|
||||
<li>
|
||||
<h3>1.1.3 <span class="layui-badge-rim">2022-05-21</span></h3>
|
||||
<ul>
|
||||
<li>[新增] input 组件 clear 事件, 清空内容时触发的无参事件</li>
|
||||
<li>[修复] tab 组件初始化时, 因无法监听到 slots 变化, 而导致 layui-tab-title 无法正常显示的问题</li>
|
||||
<li>[优化] input 组件 allow-clear 触发策略, 由始终显示调整为 v-model 不为空显示</li>
|
||||
<li>[优化] icon-picker 组件 search 功能, 为 input 输入框增加清空操作</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</lay-timeline-item>
|
||||
</lay-timeline>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
Loading…
Reference in New Issue
Block a user