feat: add v-tooltip, fix dead links and update veui

This commit is contained in:
Justineo
2021-08-24 14:26:45 +08:00
parent 6fef8697a8
commit cd5896799b
7 changed files with 108 additions and 43 deletions

View File

@@ -41,7 +41,7 @@
| `repeatInterval` | `number` | `longpress.repeatInterval` | 重复触发回调间隔的毫秒数。可进行[全局配置](#全局配置)。 |
:::warning
`Object` 类型提供的参数会覆盖通过指令参数、修饰符指定的参数。
`Object` 类型提供的参数会覆盖通过指令参数、修饰符指定的参数。
:::
### 修饰符

View File

@@ -0,0 +1,58 @@
# v-tooltip
## 简介
`v-tooltip` 指令用于通过使用 [`Tooltip` 组件](../components/tooltip)为目标元素添加提示信息。
:::tip
VEUI 对通过 `v-tooltip` 定义的全局浮层提示进行了统一的体验优化。在光标初次移入某个全局提示时,会启动“预热期”的全局计时器。在预热期内,如果光标移出目标区域,则浮层提示不会展现;如果光标在某个目标区域内直到“预热期”结束,浮层提示将在光标悬停到任何一个全局提示区域时**立刻**展现。当光标移出全局提示区域时将会启动“冷却期”计时器。在“冷却期”内,如果再次移入目标区域,则浮层提示将会立刻展现且;只有在目标区域外超过“冷却期”的时间,才会回到初始状态,再次触发浮层提示需要重新预热。
:::
## 示例
## API
:::tip
指令的具体用法请参考[官方文档](https://cn.vuejs.org/v2/guide/syntax.html#%E6%8C%87%E4%BB%A4)。更多详细参数请参考[自定义指令](https://cn.vuejs.org/v2/guide/custom-directive.html#%E9%92%A9%E5%AD%90%E5%87%BD%E6%95%B0%E5%8F%82%E6%95%B0)。
:::
### 绑定值
类型:`string|Object`
使用 `string` 类型表示提示的文本信息:
```html
<button v-tooltip="添加">+</button>
```
使用 `Object` 类型时绑定值可完整配置所有参数。例如:
```html
<button v-tooltip="{
content: '添加',
position: 'top',
disabled: false
}">+</button>
```
| 参数 | 类型 | 默认值 | 描述 |
| -- | -- | -- | -- |
| `content` | `string|VNode|Array<VNode>` | - | 提示信息字符串或通过渲染函数返回的虚拟节点(数组)。 |
| `position` | `string` | - | 浮层提示的展示位置。参考 [`Tooltip`](../components/tooltip) 组件的 [`position`](../components/tooltip#props) 属性。 |
| `disabled` | `boolean` | `false` | 是否禁用浮层提示。 |
### 修饰符
对应 `Object` 类型绑定值中的 `position`。例如:
```html
<button v-tooltip.bottom-end="添加">+</button>
```
### 全局配置
| 配置项 | 类型 | 默认值 | 描述 |
| -- | -- | -- | -- |
| `tooltip.warmup` | `number` | `800` | 完成“预热”所需的毫秒数。 |
| `tooltip.cooldown` | `number` | `800` | 完成“冷却”所需要的毫秒数。 |

View File

@@ -91,8 +91,6 @@ We intend to transpile and build VEUI and its dependencies along with the applic
When using `veui-theme-dls`, you need to import the base stylesheet, which includes style normalization.
You also need to import `:focus-visible` polyfill for better focus style to work properly ([Why?](./getting-started/focus-visible)).
Import from JavaScript:
```js

View File

@@ -93,8 +93,6 @@ VEUI 采取了样式主题与组件代码分离的开发、发布方式。组件
在使用 `veui-theme-dls` 时,需要先全局引入基础样式以及,包括样式的 normalize 及一些基本元素的样式。
除此之外还需自行引入 `:focus-visible` polyfill 以更好地处理焦点交互样式([为什么?](./getting-started/focus-visible))。
从 JavaScript 引入:
```js

View File

@@ -17,10 +17,6 @@
"title": "veui-loader",
"slug": "veui-loader"
},
{
"title": ":focus-visible",
"slug": "focus-visible"
},
{
"title": "预设样式",
"slug": "style-variants"
@@ -337,6 +333,10 @@
{
"title": "v-longpress",
"slug": "v-longpress"
},
{
"title": "v-tooltip",
"slug": "v-tooltip"
}
]
},
@@ -405,10 +405,6 @@
"title": "veui-loader",
"slug": "veui-loader"
},
{
"title": ":focus-visible",
"slug": "focus-visible"
},
{
"title": "Style variants",
"slug": "style-variants"
@@ -661,49 +657,59 @@
"sub": true
},
{
"title": "Loading - 加载",
"title": "Loading",
"slug": "loading",
"disabled": true
},
{
"title": "TimePicker - 时间选择",
"title": "TimePicker",
"slug": "time-picker",
"disabled": true
},
{
"title": "Autocomplete - 自动完成",
"title": "Autocomplete",
"slug": "autocomplete",
"disabled": true
},
{
"title": "Anchor - 锚点",
"title": "Anchor",
"slug": "anchor",
"disabled": true
},
{
"title": "Drawer - 抽屉",
"title": "Drawer",
"slug": "drawer",
"disabled": true
},
{
"title": "Embedded - 嵌入式面板",
"title": "Embedded",
"slug": "embedded",
"disabled": true
},
{
"title": "Menu - 导航菜单",
"title": "Menu",
"slug": "menu",
"disabled": true
},
{
"title": "Collapse - 折叠式面板",
"title": "Collapse",
"slug": "collapse",
"disabled": true
},
{
"title": "Accordion - 手风琴面板",
"title": "Accordion",
"slug": "accordion",
"disabled": true
},
{
"title": "Lightbox",
"slug": "lightbox",
"disabled": true
},
{
"title": "Cascader",
"slug": "cascader",
"disabled": true
}
]
},
@@ -736,6 +742,11 @@
"title": "v-longpress",
"slug": "v-longpress",
"disabled": true
},
{
"title": "v-tooltip",
"slug": "v-tooltip",
"disabled": true
}
]
},