找了好久没找到,只好自己造轮子了,基于Mui 用popover 做的,谁能帮忙美化一下?
代码还没整理完,整理完了上源码,核心代码也很简单
start: function(event) {
if (this.handle_key(event)) {
return;
}
if (!this.ready) {
this.init();
}
this.deleteDIV();
this.search_value = this.obj.value.toUpperCase();
if (this.obj.value.replace(/(^\s*)|(\s*$)/g, '') == "") {
this.togglelist('hide');
return;
}
try {
var reg = new RegExp("(" + this.obj.value + ")", "i");
} catch (e) {
return;
}
var div_index = 0;
for (var i = 0; i < this.capital_arr.length; i++) {
if (reg.test(this.capital_arr[i])) {
var div = document.createElement("div");
div.innerText = this.value_arr[i];
//TODO: onclick
div.onclick = this.setValue(this);
//div.innerHTML=valueArr[i].replace(reg,"<strong>$1</strong>");
this.autoObj.appendChild(div);
div_index++;
}
}
if (div_index > 0) {
// console.log(div_index)
this.togglelist('show');
}
},
拼音部分有Unicode码表,查表得到