古诗词名字生成器帮助你在线生成古诗词名字,包含:诗经、楚辞、唐诗、宋词、辞赋等古风的名字,这些名字都非常的优美好听,希望你们能够喜欢这款古诗词起名工具。
代码片段
async subName() {
let name_arr = Object.keys(this.userName);
let reg = /^([\u4E00-\u9FA5])*$/;
const shici = this.value;
if(name_arr.length == 0){
return FK.Utils.UToast("姓氏不能为空");
}
if(name_arr.length>2){
return FK.Utils.UToast("姓氏不能超过两位");
}
if(!reg.test(this.userName)) {
return FK.Utils.UToast("姓氏必须是汉字");
}
let bookData = Namer.loadBook(shici);
const n = 20;
const html = [];
for (let i = 0; i < n; i++) {
let nameObj = Namer.genName(bookData,this.nameValue);
if(!nameObj){
continue;
}
let name = nameObj.name;
let sentence = nameObj.sentence;
nameObj.sentenceHtml = "「"+sentence.replace(new RegExp(`[${name}]`, 'ig'), char => `<text class='i'>${char}</text>`)+"」";
nameObj.name = this.userName+name;
html.push(nameObj);
}
this.nameList = html;
}