mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-16 04:35:42 +00:00
Merge branch 'master' of gitee.com:yoimiya-kokomi/miao-plugin
Conflicts: components/Format.js
This commit is contained in:
commit
23c06511b6
@ -1,5 +1,6 @@
|
||||
import lodash from 'lodash'
|
||||
import Elem from './common-lib/elem.js'
|
||||
import { Cfg } from '../components/index.js'
|
||||
|
||||
let Format = {
|
||||
...Elem,
|
||||
@ -9,7 +10,8 @@ let Format = {
|
||||
comma: function (num, fix = 0) {
|
||||
num = parseFloat((num * 1).toFixed(fix))
|
||||
let [integer, decimal] = String.prototype.split.call(num, '.')
|
||||
integer = integer.replace(/\d(?=(\d{3})+$)/g, '$&,') // 正则先行断言
|
||||
let re = new RegExp(`\\d(?=(\\d{${Cfg.get('commaGroup', 3)}})+$)`, 'g')
|
||||
integer = integer.replace(re, '$&,') // 正则先行断言 = /\d(?=(\d{3})+$)/g
|
||||
return `${integer}${fix > 0 ? '.' + (decimal || lodash.repeat('0', fix)) : ''}`
|
||||
},
|
||||
pct: function (num, fix = 1) {
|
||||
|
@ -17,6 +17,9 @@ export const avatarWife = true
|
||||
// 戳一戳卡片
|
||||
export const avatarPoke = true
|
||||
|
||||
// 数字分组
|
||||
export const commaGroup = 3
|
||||
|
||||
/** ************ 【角色资料与信息查询】 ************* */
|
||||
// #刻晴图鉴 的图鉴信息
|
||||
export const charWiki = true
|
||||
|
@ -47,7 +47,14 @@ export const cfgSchema = {
|
||||
key: '戳一戳',
|
||||
def: true,
|
||||
oldCfgKey: 'char.poke'
|
||||
}
|
||||
},
|
||||
commaGroup: {
|
||||
title: '数字逗号分组',
|
||||
key: '逗号',
|
||||
def: 3,
|
||||
type: 'num',
|
||||
desc: '根据语言习惯设置数字分组,如千位组设为 3,万位组设为 4。(暂不支持欧洲样式)'
|
||||
},
|
||||
}
|
||||
},
|
||||
wiki: {
|
||||
|
Loading…
Reference in New Issue
Block a user