Skip to content

Commit

Permalink
docs(floating-panel): add descriptions for examples
Browse files Browse the repository at this point in the history
  • Loading branch information
chouchouji committed Oct 11, 2023
1 parent 44cdc94 commit cb14eed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/varlet-ui/src/floating-panel/docs/en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
A panel floating at the bottom of the page, allowing users to freely drag up and down through content, is often used to provide additional functionality or information.

### Basic Usage
The default height of the FloatingPanel is `100px`, allowing dragging to expand or shrink the panel, and the default maximum height of the expansion is `60%` of the screen.

```html
<template>
Expand All @@ -17,6 +18,9 @@ A panel floating at the bottom of the page, allowing users to freely drag up and
```

### Custom Anchors
The anchor position of the FloatingPanel can be set via the `anchors` property (the default two anchors are at `100px` and `60%` of the screen), and the display height of the current panel can be controlled by `v-model:height`.

For example, dock the height of the panel at 100px, 40% screen height, and 80% screen height:

```html
<script setup>
Expand All @@ -34,6 +38,7 @@ const height = ref([anchors[0]])
```

### Drag Head Only
By default, both the head area and the content area of a FloatingPanel can be dragged. If you want to disable dragging of the content area, set the `content-draggable` property to `false`.

```html
<template>
Expand Down
5 changes: 5 additions & 0 deletions packages/varlet-ui/src/floating-panel/docs/zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
浮动在页面底部的面板,用户可自由灵活上下滑动浏览内容,常用于提供额外的功能或信息。

### 基本使用
FloatingPanel 的默认高度为 `100px`,允许拖动来展开或者收缩面板,默认展开的最大高度为屏幕的 `60%`

```html
<template>
Expand All @@ -17,6 +18,9 @@
```

### 自定义锚点
可以通过 `anchors` 属性来设置 FloatingPanel 的锚点位置(默认的两个锚点分别位于 `100px` 和 屏幕的 `60%`),并通过 `v-model:height` 来控制当前面板的显示高度。

例如,使面板的高度在 100px、40% 屏幕高度和 80% 屏幕高度三个位置停靠:

```html
<script setup>
Expand All @@ -34,6 +38,7 @@ const height = ref([anchors[0]])
```

### 仅头部拖拽
默认情况下,FloatingPanel 的头部区域和内容区域都可以被拖动。如果想禁用内容区域的拖拽,可设置 `content-draggable` 属性为 `false`

```html
<template>
Expand Down

0 comments on commit cb14eed

Please sign in to comment.