From 4783085a991db4f143b3751146e26a5bf9eddc92 Mon Sep 17 00:00:00 2001 From: xiaoshi <115949669+xiaoshi930@users.noreply.github.com> Date: Fri, 28 Nov 2025 21:49:39 +0800 Subject: [PATCH] Update xiaoshi-device-update-card.js --- xiaoshi-device-update-card.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/xiaoshi-device-update-card.js b/xiaoshi-device-update-card.js index 3bd9c26..786fef6 100644 --- a/xiaoshi-device-update-card.js +++ b/xiaoshi-device-update-card.js @@ -468,7 +468,7 @@ export class XiaoshiUpdateCard extends LitElement { } _handleEntityClick(entity) { - navigator.vibrate(50); + this._handleClick(); // 点击实体时打开实体详情页 if (entity.entity_id) { // 使用您建议的第一种方式 @@ -478,6 +478,17 @@ export class XiaoshiUpdateCard extends LitElement { } } + _handleClick(){ + if (navigator.vibrate) { + navigator.vibrate(50); + } + else if (navigator.webkitVibrate) { + navigator.webkitVibrate(50); + } + else { + } + } + async _loadUpdateData() { if (!this.hass) return; @@ -552,12 +563,12 @@ export class XiaoshiUpdateCard extends LitElement { } _handleRefresh() { + this._handleClick(); this._loadUpdateData(); - navigator.vibrate(50); } _handleUpdateClick(update) { - navigator.vibrate(50); + this._handleClick(); // 点击更新项时弹出实体详情 // 如果有entity_id,弹出实体详情 @@ -577,9 +588,9 @@ export class XiaoshiUpdateCard extends LitElement { } _handleConfirmUpdate(update, event) { + this._handleClick(); event.stopPropagation(); // 阻止事件冒泡 event.preventDefault(); // 阻止默认行为 - navigator.vibrate(50); // 弹出确认对话框 const confirmed = confirm(`确认要更新 ${update.name} 吗?\n当前版本: ${update.current_version}\n最新版本: ${update.latest_version}`);