(chore)fix index navigate, replace repeat, use
pseudo content.
This commit is contained in:
parent
981577f4ff
commit
36f6292873
|
@ -14,16 +14,13 @@ export class StarBubble extends LitElement {
|
|||
else if (this.number > 99)
|
||||
return html`
|
||||
<div>
|
||||
<span class="small">
|
||||
99
|
||||
<sup>+</sup>
|
||||
</span>
|
||||
<a class="small" data-num="99"><sup>+</sup></a>
|
||||
</div>
|
||||
`
|
||||
else
|
||||
return html`
|
||||
<div>
|
||||
<span>${this.number}</span>
|
||||
<a data-num=${this.number}></a>
|
||||
</div>
|
||||
`
|
||||
}
|
||||
|
@ -45,7 +42,7 @@ export class StarBubble extends LitElement {
|
|||
background-color: red;
|
||||
}
|
||||
|
||||
span {
|
||||
a {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
color: #fff;
|
||||
|
@ -55,11 +52,15 @@ export class StarBubble extends LitElement {
|
|||
font-size: 14px;
|
||||
}
|
||||
|
||||
span.small {
|
||||
a.small {
|
||||
font-size: 12px;
|
||||
line-height: 170%;
|
||||
}
|
||||
|
||||
a::before {
|
||||
content: attr(data-num);
|
||||
}
|
||||
|
||||
sup {
|
||||
font-size: 10px;
|
||||
max-width: 6px;
|
||||
|
|
|
@ -12,7 +12,7 @@ export class IndicatorPagePoint extends LitElement {
|
|||
#firstRender = true
|
||||
|
||||
protected shouldUpdate(
|
||||
_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>
|
||||
_changedProperties: PropertyValueMap<this>
|
||||
): boolean {
|
||||
let isShouldUpdate = true
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {html, css, LitElement, HTMLTemplateResult, nothing} from 'lit'
|
||||
import {customElement, property} from 'lit/decorators.js'
|
||||
import {classMap} from 'lit/directives/class-map.js'
|
||||
import '../bubble/bubble'
|
||||
|
||||
export enum LiType {
|
||||
|
|
18
src/index.ts
18
src/index.ts
|
@ -1,10 +1,7 @@
|
|||
import {html, css, LitElement} from 'lit'
|
||||
import {customElement, query, state} from 'lit/decorators.js'
|
||||
import './components/ul/ul'
|
||||
import './components/li/li'
|
||||
import './components/section/section'
|
||||
import {StarAnimateSection} from './components/section/section'
|
||||
|
||||
import './components/section/section'
|
||||
import './test/panels/root'
|
||||
|
||||
@customElement('settings-app')
|
||||
|
@ -17,6 +14,17 @@ export class SettingsApp extends LitElement {
|
|||
@state() nextSection: StarAnimateSection | null = null
|
||||
@state() currentSection: StarAnimateSection | null = null
|
||||
|
||||
constructor() {
|
||||
super()
|
||||
window.addEventListener('hashchange', this)
|
||||
this.updateComplete.then(() => {
|
||||
// 在页面内刷新时
|
||||
if (location.hash !== '') {
|
||||
this.navigate(location.hash)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
handleEvent(evt: Event) {
|
||||
switch (evt.type) {
|
||||
case 'hashchange':
|
||||
|
@ -115,8 +123,6 @@ export class SettingsApp extends LitElement {
|
|||
}
|
||||
|
||||
render() {
|
||||
window.addEventListener('hashchange', this)
|
||||
|
||||
return html`
|
||||
<star-animate-section id="root" class="active">
|
||||
<panel-root></panel-root>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {html, LitElement, CSSResultArray} from 'lit'
|
||||
import {customElement, property, state} from 'lit/decorators.js'
|
||||
import {repeat} from 'lit/directives/repeat.js'
|
||||
import {map} from 'lit/directives/map.js'
|
||||
import {UlType} from '../../../../components/ul/ul'
|
||||
import {LiType} from '../../../../components/li/li'
|
||||
import {sharedStyles} from '../../shared-styles'
|
||||
|
@ -246,11 +246,11 @@ export class PanelAboutMachine extends LitElement {
|
|||
|
||||
render() {
|
||||
return html`
|
||||
${repeat(
|
||||
${map(
|
||||
this.paneljson,
|
||||
(block: BLOCKNODE) => html`
|
||||
<star-ul type=${block.nodetype} title=${block.nodetitle}>
|
||||
${repeat(
|
||||
${map(
|
||||
block.nodes,
|
||||
(node: LINENODE, index) => html`
|
||||
${node.href
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {html, LitElement, CSSResultArray} from 'lit'
|
||||
import {customElement, property, state} from 'lit/decorators.js'
|
||||
import {repeat} from 'lit/directives/repeat.js'
|
||||
import {map} from 'lit/directives/map.js'
|
||||
import {UlType} from '../../../components/ul/ul'
|
||||
import {LiType} from '../../../components/li/li'
|
||||
import {sharedStyles} from '../shared-styles'
|
||||
|
@ -264,7 +264,7 @@ export class PanelIcon extends LitElement {
|
|||
title="GaiaIcon图标"
|
||||
text="以上GaiaIcon图标为YROS V4内容"
|
||||
>
|
||||
${repeat(
|
||||
${map(
|
||||
this.icons,
|
||||
(iconname, index) => html`
|
||||
<star-li
|
||||
|
|
|
@ -3,6 +3,9 @@ import {customElement, state} from 'lit/decorators.js'
|
|||
import {LiType} from '../../components/li/li'
|
||||
import {UlType} from '../../components/ul/ul'
|
||||
import {sharedStyles} from './shared-styles'
|
||||
import '../../components/ul/ul'
|
||||
import '../../components/li/li'
|
||||
|
||||
import './about/about'
|
||||
import './icon/icon'
|
||||
import './general/general'
|
||||
|
|
Loading…
Reference in New Issue