feat(tab): 新增 allowClose 属性, change close 事件

This commit is contained in:
就眠仪式
2021-10-15 23:52:01 +08:00
parent b083b50111
commit 6c0cb3041a
8 changed files with 104 additions and 16 deletions

View File

@@ -1,7 +1,12 @@
::: demo
<template>
<lay-carousel></lay-carousel>
<lay-carousel>
<lay-carousel-item>条目一</lay-carousel-item>
<lay-carousel-item>条目二</lay-carousel-item>
<lay-carousel-item>条目三</lay-carousel-item>
<lay-carousel-item>条目四</lay-carousel-item>
</lay-carousel>
</template>
<script>

View File

@@ -76,12 +76,59 @@ export default {
:::
::: demo
<template>
<lay-tab type="card" v-model="current3" :allow-close="allowClose" @change="change" @close="close">
<lay-tab-item title="选项一" id="1"><div style="padding:20px">选项一</div></lay-tab-item>
<lay-tab-item title="选项二" id="2"><div style="padding:20px">选项二</div></lay-tab-item>
</lay-tab>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
const current4 = ref("1")
const allowClose = ref(true)
const change = function(id){
console.log("当前值:" +id)
}
const close = function(id){
console.log("需要关闭:" + id)
}
return {
current3,
allowClose,
change,
close
}
}
}
</script>
:::
::: field tab attributes
:::
| | | |
| Name | Description | Accepted Values |
| ------- | -------- | -------------- |
| v-model | 当前激活 | -- |
| type | 主题样式 | `card` `brief` |
| type | 主题样式 | -- |
| allow-close | 允许关闭 | `true` `false` |
::: field tab events
:::
| Name | Description | Accepted Params |
| -------- | ---- | ----------------------- |
| change | 选中切换 | -- |
| close | 关闭事件 | -- |