重命名 docs 为 example

This commit is contained in:
就眠儀式
2021-11-23 11:08:40 +08:00
parent 97788e3a77
commit 4a4ee87b65
88 changed files with 14 additions and 7 deletions

View File

@@ -0,0 +1,42 @@
::: title 基础使用
:::
::: block 使 用 useClickOutside 监 听 元 素 外 click 事 件
:::
```vue
<template>
<lay-button type="primary" ref="buttonRef">当前元素</lay-button>
</template>
<script>
import { ref, watch } from 'vue'
import useClickOutside from '/@src/hooks/useClickOutside'
export default {
setup() {
const buttonRef = (ref < null) | (HTMLElement > null)
const isClickOutside = useClickOutside(buttonRef)
watch(isClickOutside, () => {
console.log('元素外 click 事件')
})
return {
buttonRef,
}
},
}
</script>
```
::: title 使用备注
:::
::: table
| 备注 | 描述 | 类型 |
| -------------- | --------------- | ---- |
| isClickOutside | 使用 watch 监听 | Ref |
:::

View File

@@ -0,0 +1,42 @@
::: title 基础使用
:::
::: block 使 用 useMove 为 元 素 提 供 拖 拽 支 持
:::
```vue
<template>
<lay-button @click="fullScreen">全屏切换</lay-button>
</template>
<script>
import useFullScreen from '/@src/hooks/useFullScreen'
export default {
setup() {
const { fullScreen, isFullScreen } = useFullScreen()
watch(isFullScreen, () => {
console.log('全屏切换')
})
return {
fullScreen,
isFullScreen,
}
},
}
</script>
```
::: title 使用备注
:::
::: table
| 事件 | 描述 | 类型 |
| ------------ | -------- | -------- |
| fullScreen | 全屏切换 | Function |
| isFullScreen | 当前状态 | Ref |
:::

View File

@@ -0,0 +1,37 @@
::: title 基础使用
:::
::: block 使 用 useFullScreen 快 速 完 成 fullScreen 操 作
:::
```vue
<template>
<button id="button">拖动</button>
</template>
<script>
import { ref, watch, onMounted } from 'vue'
import useMove from '/@src/hooks/useMove'
export default {
setup() {
onMounted(() => {
const el = document.getElementById('button')
useMove(el)
})
return {}
},
}
</script>
```
::: title 使用备注
:::
::: table
| 备注 | 描述 | 类型 |
| ---- | -------------- | ----------- |
| el | 需要拖拽的元素 | HtmlElement |
:::