(component): [tooltip]新增 visible 参数;修复定位; content 变化时更新位置

This commit is contained in:
sight
2022-09-06 12:14:52 +08:00
parent 4b30714dab
commit 20a49818a3
4 changed files with 115 additions and 21 deletions

View File

@@ -389,11 +389,11 @@ export default {
| 属性 | 描述 | 类型 | 默认值 | 可选值 |
| ------------------- | -------------------------------------------------- | ----------------------------------------- | -------- | ----------------------------- |
| v-model | 当前激活 | `string` | - | - |
| type | 主题样式 | `string` | - | - |
| type | 主题样式 | `string` | - | `brief` `card` |
| tabPosition | 位置 | `string` | `bottom` | `top` `bottom` `left` `right` |
| allow-close | 允许关闭 | `boolean` | `false` | `true` `false` |
| before-close | `Function`关闭之前的回调钩子函数 | 参数(`id`), `return false` 表示不进行关闭 | - | - |
| before-leave | `Function`切换标签之前的回调钩子函数 | 参数(`id`), `return false` 表示不进行切换 | - | - |
| before-close | 关闭之前的回调钩子函数,参数(`id`), `return false` 表示不进行关闭 | `Function` | - | - |
| before-leave | 切换标签之前的回调钩子函数, 参数(`id`), `return false` 表示不进行关闭 | `Function` | - | - |
| activeBarTransition | 是否开启 activeBar 动画,仅 brief 有效,默认 `false` | `boolean` | `false` | `true` `false` |
:::

View File

@@ -48,9 +48,35 @@ setup() {
<lay-button>tooltip</lay-button>
</lay-tooltip>
</template>
:::
::: title 外部控制
:::
::: demo
<template>
<lay-button @click="visible = !visible">{{visible ? '显示' : '隐藏'}}</lay-button>
<div style="padding: 100px">
<lay-tooltip position="right" content="时光都淡了,我还伴着你。" :visible="visible">
<lay-button>tooltip</lay-button>
</lay-tooltip>
</div>
</template>
<script>
import { ref,watch } from 'vue';
export default {
setup() {
const visible = ref(false)
return {
visible,
}
}
}
</script>
<style>
</style>
:::
::: title 显示位置