提交 6ad09d65 编写于 作者: X xjh22222228

style: LINT

上级 27bedd97
......@@ -86,8 +86,8 @@ export class CreateWebComponent implements OnInit {
async onUrlBlur(e) {
const res = await getLogoUrl(e.target?.value)
if (res) {
this.iconUrl = (res || '') as string
this.validateForm.get('icon')!.setValue(res || '')
this.iconUrl = res as string
this.validateForm.get('icon')!.setValue(this.iconUrl)
}
}
......@@ -109,7 +109,7 @@ export class CreateWebComponent implements OnInit {
}
handlePasteImage = event => {
const items = event.clipboardData?.items
const items = event.clipboardData.items
let file = null
if (items.length) {
......
......@@ -204,7 +204,7 @@ export function parseBookmark(htmlStr: string) {
function r(data: any[], list: any[]) {
for (let i = 0; i < data.length; i++) {
const item = data[i] as any
const title = item.title || item?.name
const title = item.title || item.name
const idx = list.findIndex(item => (item.title || item.name) === title)
// Repeat
......
......@@ -149,10 +149,7 @@ export function queryString(): {
page = websiteList.length - 1;
id = 0;
} else {
page = page;
if (id <= websiteList[page].nav.length - 1) {
id = id;
} else {
if (!(id <= websiteList[page].nav.length - 1)) {
id = websiteList[page].nav.length - 1;
}
}
......@@ -230,19 +227,19 @@ export function setWebsiteList(v?: INavProps[]) {
}
export function toggleCollapseAll(wsList?: INavProps[]): boolean {
wsList = wsList || websiteList
wsList ||= websiteList
const { page, id } = queryString()
const collapsed = !websiteList[page].nav[id].collapsed
const collapsed = !wsList[page].nav[id].collapsed
websiteList[page].nav[id].collapsed = collapsed
wsList[page].nav[id].collapsed = collapsed
websiteList[page].nav[id].nav.map(item => {
wsList[page].nav[id].nav.map(item => {
item.collapsed = collapsed
return item
})
setWebsiteList(websiteList)
setWebsiteList(wsList)
return collapsed
}
......@@ -330,12 +327,12 @@ export function copyText(el: Event, text: string): Promise<boolean> {
return new Promise(resolve => {
const clipboard = new Clipboard(`#${ranId}`)
clipboard.on('success', function() {
clipboard?.destroy?.()
clipboard.destroy()
resolve(true)
});
clipboard.on('error', function() {
clipboard?.destroy?.()
clipboard.destroy()
resolve(false)
});
})
......
......@@ -2,19 +2,8 @@
import config from '../../../../nav.config'
import { Component } from '@angular/core'
import { Router, ActivatedRoute } from '@angular/router'
import { INavProps, INavThreeProp } from '../../../types'
import {
fuzzySearch,
queryString,
setWebsiteList,
toggleCollapseAll,
totalWeb,
} from '../../../utils'
import { initRipple, setAnnotate } from '../../../utils/ripple'
import { websiteList } from '../../../store'
const { gitRepoUrl, title, simThemeConfig } = config
const { title } = config
@Component({
selector: 'app-shortcut',
......@@ -24,5 +13,5 @@ const { gitRepoUrl, title, simThemeConfig } = config
export default class ShortcutComponent {
title = title
constructor (private router: Router, private activatedRoute: ActivatedRoute) {}
constructor () {}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册