2021-10-26 01:13:23 +08:00
|
|
|
::: title 基础使用
|
2021-10-19 22:28:44 +08:00
|
|
|
:::
|
|
|
|
|
2021-10-05 19:04:06 +08:00
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
2021-10-13 02:32:29 +08:00
|
|
|
<lay-tab v-model="current1">
|
2021-10-08 19:57:03 +08:00
|
|
|
<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>
|
2021-10-08 17:32:05 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
setup() {
|
|
|
|
|
2021-10-13 02:32:29 +08:00
|
|
|
const current1 = ref("1")
|
2021-10-08 19:57:03 +08:00
|
|
|
|
2021-10-08 17:32:05 +08:00
|
|
|
return {
|
2021-10-13 02:32:29 +08:00
|
|
|
current1
|
2021-10-08 17:32:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
2021-10-26 01:13:23 +08:00
|
|
|
::: title 简约模式
|
2021-10-19 22:28:44 +08:00
|
|
|
:::
|
|
|
|
|
2021-10-08 17:32:05 +08:00
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
2021-10-08 19:57:03 +08:00
|
|
|
<lay-tab type="brief" v-model="current2">
|
|
|
|
<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>
|
2021-10-08 17:32:05 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
setup() {
|
|
|
|
|
2021-10-08 19:57:03 +08:00
|
|
|
const current2 = ref("1")
|
|
|
|
|
2021-10-08 17:32:05 +08:00
|
|
|
return {
|
2021-10-08 19:57:03 +08:00
|
|
|
current2
|
2021-10-08 17:32:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
2021-10-26 01:13:23 +08:00
|
|
|
::: title 卡片模式
|
2021-10-19 22:28:44 +08:00
|
|
|
:::
|
|
|
|
|
2021-10-08 17:32:05 +08:00
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
2021-10-08 19:57:03 +08:00
|
|
|
<lay-tab type="card" v-model="current3">
|
|
|
|
<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>
|
2021-10-05 19:04:06 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
setup() {
|
|
|
|
|
2021-10-08 19:57:03 +08:00
|
|
|
const current3 = ref("1")
|
|
|
|
|
2021-10-05 19:04:06 +08:00
|
|
|
return {
|
2021-10-08 19:57:03 +08:00
|
|
|
current3
|
2021-10-05 19:04:06 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2021-10-09 10:41:52 +08:00
|
|
|
:::
|
|
|
|
|
2021-10-26 01:13:23 +08:00
|
|
|
::: title 允许关闭
|
2021-10-19 22:28:44 +08:00
|
|
|
:::
|
|
|
|
|
2021-10-15 23:52:01 +08:00
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
2021-10-19 11:47:27 +08:00
|
|
|
<lay-tab type="card" v-model="current4" :allow-close="allowClose" @change="change" @close="close">
|
2021-10-15 23:52:01 +08:00
|
|
|
<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 {
|
2021-10-19 11:47:27 +08:00
|
|
|
current4,
|
2021-10-15 23:52:01 +08:00
|
|
|
allowClose,
|
|
|
|
change,
|
|
|
|
close
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
2021-10-13 02:32:29 +08:00
|
|
|
|
|
|
|
:::
|
|
|
|
|
2021-10-26 01:13:23 +08:00
|
|
|
::: title 嵌套循环
|
2021-10-19 22:28:44 +08:00
|
|
|
:::
|
2021-10-19 11:47:27 +08:00
|
|
|
|
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
2021-10-19 22:28:44 +08:00
|
|
|
<lay-tab type="card" v-model="current5" @change="change5">
|
2021-10-19 11:47:27 +08:00
|
|
|
<lay-tab-item v-for="a in arr" :key="a" :title="a.title" :id="a.id">
|
|
|
|
</lay-tab-item>
|
|
|
|
</lay-tab>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
setup() {
|
|
|
|
|
|
|
|
const current5 = ref('1')
|
2021-10-19 22:28:44 +08:00
|
|
|
const change5 = function(id){
|
|
|
|
alert(id)
|
|
|
|
}
|
2021-10-19 11:47:27 +08:00
|
|
|
|
2021-10-19 22:28:44 +08:00
|
|
|
const arr = ref([
|
2021-10-19 11:47:27 +08:00
|
|
|
{id:'1', title:'选项一'},
|
|
|
|
{id:'2', title:'选项二'}
|
2021-10-19 22:28:44 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
arr.value.push({id:'3', title:'选项三'})
|
2021-10-19 11:47:27 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
current5,
|
|
|
|
arr
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
2021-11-01 01:02:21 +08:00
|
|
|
::: title 选项卡属性
|
2021-10-15 23:52:01 +08:00
|
|
|
:::
|
2021-10-12 18:00:09 +08:00
|
|
|
|
2021-11-07 15:55:08 +08:00
|
|
|
::: table
|
|
|
|
|
2021-11-01 01:02:21 +08:00
|
|
|
| 属性 | 描述 | 可选值 |
|
|
|
|
| ----------- | -------- | -------------- |
|
|
|
|
| v-model | 当前激活 | -- |
|
|
|
|
| type | 主题样式 | -- |
|
|
|
|
| allow-close | 允许关闭 | `true` `false` |
|
2021-10-15 23:52:01 +08:00
|
|
|
|
2021-11-07 15:55:08 +08:00
|
|
|
:::
|
|
|
|
|
2021-11-01 01:02:21 +08:00
|
|
|
::: title 选项卡事件
|
2021-10-15 23:52:01 +08:00
|
|
|
:::
|
|
|
|
|
2021-11-07 15:55:08 +08:00
|
|
|
::: table
|
|
|
|
|
2021-11-01 01:02:21 +08:00
|
|
|
| 事件 | 描述 | 参数 |
|
|
|
|
| ------ | -------- | ---- |
|
|
|
|
| change | 选中切换 | -- |
|
|
|
|
| close | 关闭事件 | -- |
|
2021-11-07 15:55:08 +08:00
|
|
|
|
2021-11-07 15:56:24 +08:00
|
|
|
:::
|