forked from natuka/web.puabadge.com
修改:相框标题显示18字符
This commit is contained in:
1 parent
085885b6a6
commit
9cc1275cd7
1 file changed
+2
-2
@@ -348,12 +348,12 @@ const getCharUnits = (str: string) => {
|
||||
|
||||
// 限制最多 12 个字符单位:中文占2个,英文/数字/空格/符号占1个
|
||||
const scenePropInputText = (val: string) => {
|
||||
if (getCharUnits(val) > 12) {
|
||||
if (getCharUnits(val) > 18) {
|
||||
let units = 0
|
||||
let i = 0
|
||||
for (; i < val.length; i++) {
|
||||
const add = /[\u4e00-\u9fff\u3400-\u4dbf]/.test(val[i]) ? 2 : 1
|
||||
if (units + add > 12) break
|
||||
if (units + add > 18) break
|
||||
units += add
|
||||
}
|
||||
val = val.slice(0, i)
|
||||
|
||||
Reference in new issue
Block a user