Merge pull request #89 in YR/star-web-components from fixbug_1013 to master

* commit 'cf305e60175eac62db7ad2be0e77c4fa81e12027':
  (fixbug)修复电量显示和退出编辑模式翻页异常
This commit is contained in:
汪昌棋 2022-10-13 19:16:45 +08:00
commit 8c5bbddac0
3 changed files with 5 additions and 4 deletions

View File

@ -26,7 +26,7 @@ class GaiaContainerPage {
this.deletePage(page)
}
this.removeTail()
this._manager.turnPre('reset')
this._manager.resetView('reset')
}
})
@ -107,6 +107,7 @@ class GaiaContainerPage {
if (!this._tail || !this._shadowTail || this._tail.children.length) {
const pages = this.addPage()
this._tail = pages.page
this._suspending.push(this._tail)
this._shadowTail = pages.shadowPage
this._suspending.push(this._tail)
this._manager.addPage({page: this._tail, shadowPage: this._shadowTail})

View File

@ -1,4 +1,4 @@
import {html, LitElement, css, CSSResultArray, PropertyValueMap} from 'lit'
import {html, LitElement, css, PropertyValueMap} from 'lit'
import {customElement, property, query} from 'lit/decorators.js'
// import {sharedStyles} from './pattern-view-style'

View File

@ -31,7 +31,7 @@ class BatteryWidget extends GaiaWidget {
async init() {
// @ts-ignore
this._battery = await navigator.getBattery()
this.percent = this._battery.level
this.percent = this._battery.level * 100
this.charge = this._battery.charging
this._battery.addEventListener('levelchange', this)
this._battery.addEventListener('chargingchange', this)
@ -40,7 +40,7 @@ class BatteryWidget extends GaiaWidget {
handleEvent(event: Event): void {
switch (event.type) {
case 'levelchange':
this.percent = this._battery.level
this.percent = this._battery.level * 100
break
case 'chargingchange':
this.charge = this._battery.charging