优化代码

This commit is contained in:
2022-03-17 13:09:58 +08:00
parent fcd91876ce
commit 58386fd28c
13 changed files with 1931 additions and 1887 deletions

View File

@@ -1,24 +1,30 @@
// 工具信息列表
let navTools = {
// 分类
/**
* @typedef {object} ToolItem
* @property {string} title 工具标题
* @property {string} [desc] 工具简介
* @property {string} component 组件名称
* @property {string} [update] 更新日期
* @property {string} [version] 版本号
* @property {boolean} enabled 启用状态
*/
/**
* @typedef {object} ToolCategory
* @property {string} title 分类标题
* @property {Object.<string, ToolItem>} list 工具列表
*/
/** @type {Object.<string, ToolCategory>} */
const navTools = {
calculation: {
// 分类标题
title: '计算',
// 分类列表
list: {
// 工具
'download-time': {
// 工具标题
title: '下载用时计算',
// 工具简介
desc: '根据设定的文件大小和下载速度简单计算大约下载完成所需的时间。',
// 组件名称
component: 'CalcDownloadTime',
// 更新时间
update: '2021-12-06',
// 版本
version: '1',
// 启用状态
enabled: true
},
'ratio': {

View File

@@ -5,8 +5,7 @@ class Utils {
constructor() { }
/**
* 改变网页标题
*
* @description 改变网页标题
* @param {string} [value] 新的标题
*/
changeTitle(value) {
@@ -14,8 +13,7 @@ class Utils {
}
/**
* JSONP
*
* @description JSONP
* @param {object} options 配置选项
*/
jsonp(options) {
@@ -40,11 +38,9 @@ class Utils {
}
/**
* 以文本方式读取文件(异步)
*
* @description 以文本方式读取文件(异步)
* @param {Event} ev 输入框 change 事件对象
* @param {boolean} resetValue 是否自动重置输入框 value 属性
*
* @returns {Promise<string[]>} `{ name: 文件名, content: 文件内容 }`
*/
readFileAsText(ev, resetValue) {