添加全局字号,动态调整大小
This commit is contained in:
@@ -6,9 +6,9 @@ import Build from "android.os.Build";
|
||||
|
||||
/**
|
||||
* 震动
|
||||
* @param {number} duriation 震动时间单位ms
|
||||
* @param {number} duration 震动时间单位ms
|
||||
*/
|
||||
export function vibrate(duriation: number) {
|
||||
export function vibrate(duration: number) {
|
||||
try {
|
||||
const context = UTSAndroid.getAppContext() as Context;
|
||||
let vb: Vibrator | null = null;
|
||||
@@ -25,7 +25,7 @@ export function vibrate(duriation: number) {
|
||||
// Android 8.0 (API 26) 及以上使用 VibrationEffect
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
const effect = VibrationEffect.createOneShot(
|
||||
duriation.toLong(),
|
||||
duration.toLong(),
|
||||
VibrationEffect.DEFAULT_AMPLITUDE
|
||||
);
|
||||
vb.vibrate(effect);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* 震动
|
||||
* @param {number} duriation 震动时间单位ms,ios微信失效
|
||||
* @param {number} duration 震动时间单位ms,ios微信失效
|
||||
*/
|
||||
export function vibrate(duriation: number) {
|
||||
export function vibrate(duration: number) {
|
||||
wx.vibrateShort({
|
||||
type: "medium",
|
||||
success() {},
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* 震动
|
||||
* @param {number} duriation 震动时间单位ms,ios微信失效
|
||||
* @param {number} duration 震动时间单位ms,ios微信失效
|
||||
*/
|
||||
export function vibrate(duriation: number) {
|
||||
export function vibrate(duration: number) {
|
||||
try {
|
||||
navigator.vibrate(duriation);
|
||||
navigator.vibrate(duration);
|
||||
} catch (error) {
|
||||
console.error("WEB震动失败:", error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user