Update xiaoshi-device-consumables-card.js

This commit is contained in:
xiaoshi
2025-11-28 21:48:49 +08:00
committed by GitHub
parent 4fe21a2c74
commit 2c3c3fd42d

View File

@@ -906,7 +906,7 @@ class XiaoshiConsumablesCard extends LitElement {
.device-name { .device-name {
color: var(--fg-color, #000); color: var(--fg-color, #000);
font-size: 9px; font-size: 11px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
@@ -916,7 +916,7 @@ class XiaoshiConsumablesCard extends LitElement {
.device-value { .device-value {
color: var(--fg-color, #000); color: var(--fg-color, #000);
font-size: 9px; font-size: 11px;
flex-shrink: 0; flex-shrink: 0;
font-weight: bold; font-weight: bold;
max-width: 45%; max-width: 45%;
@@ -930,7 +930,7 @@ class XiaoshiConsumablesCard extends LitElement {
} }
.device-unit { .device-unit {
font-size: 9px; font-size: 11px;
color: var(--fg-color, #000); color: var(--fg-color, #000);
margin-left: 0.5px; margin-left: 0.5px;
font-weight: bold; font-weight: bold;
@@ -1112,12 +1112,12 @@ class XiaoshiConsumablesCard extends LitElement {
} }
_handleRefresh() { _handleRefresh() {
this._handleClick();
this._loadOilPriceData(); this._loadOilPriceData();
navigator.vibrate(50);
} }
_handleEntityClick(entity) { _handleEntityClick(entity) {
navigator.vibrate(50); this._handleClick();
// 点击实体时打开实体详情页 // 点击实体时打开实体详情页
if (entity.entity_id) { if (entity.entity_id) {
const evt = new Event('hass-more-info', { composed: true }); const evt = new Event('hass-more-info', { composed: true });
@@ -1126,6 +1126,17 @@ class XiaoshiConsumablesCard extends LitElement {
} }
} }
_handleClick(){
if (navigator.vibrate) {
navigator.vibrate(50);
}
else if (navigator.webkitVibrate) {
navigator.webkitVibrate(50);
}
else {
}
}
_renderDeviceItem(consumablesData) { _renderDeviceItem(consumablesData) {
let isWarning = false; let isWarning = false;