更新记录
1.0.0(2024-10-25)
循环震动,延迟,每次震动持续时间,间隔
平台兼容性
uni-app x
Chrome |
Safari |
Android |
iOS |
鸿蒙 |
微信小程序 |
- |
- |
5.0 |
× |
- |
× |
zbw-vibrate
开发文档
使用
<script lang="uts" setup>
import {vibrate, cancelVibrator, VibrateOptions} from "@/uni_modules/zbw-vibrate";
const vib = () => {
const options = {
isLoop: true,
} as VibrateOptions
vibrate(options);
}
const cancel = () => {
cancelVibrator();
}
</script>
<template>
<button @click="vib">点击震动</button>
<button @click="cancel">停止</button>
</template>
参数说明
参数 |
类型 |
是否必填 |
默认值 |
说明 |
isLoop |
boolean |
是 |
- |
是否循环 |
delay |
number |
否 |
0 |
首次执行延迟时间(ms) |
duration |
number |
否 |
100 |
每次震动持续时间(ms) |
interval |
number |
否 |
1000 |
每次震动间隔时间 (ms) |