2019-04-30 11:11:25 +08:00
|
|
|
const db = [
|
|
|
|
{
|
2019-06-05 16:54:39 +08:00
|
|
|
"label": "诸葛亮",
|
|
|
|
"value": "zhugeliang"
|
2019-04-30 11:11:25 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2019-06-05 16:54:39 +08:00
|
|
|
"label": "王昭君",
|
|
|
|
"value": "wangzhaojun"
|
2019-04-30 11:11:25 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2019-06-05 16:54:39 +08:00
|
|
|
"label": "钟馗",
|
|
|
|
"value": "zhongkui"
|
2019-04-30 11:11:25 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2019-06-05 16:54:39 +08:00
|
|
|
"label": "露娜",
|
|
|
|
"value": "luna"
|
2019-04-30 11:11:25 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2019-06-05 16:54:39 +08:00
|
|
|
"label": "钟无艳",
|
|
|
|
"value": "zhongwuyan"
|
2019-04-30 11:11:25 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2019-06-05 16:54:39 +08:00
|
|
|
"label": "花木兰",
|
|
|
|
"value": "huamulan"
|
2019-04-30 11:11:25 +08:00
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = function(req, res) {
|
|
|
|
const term = req.query.term || '';
|
|
|
|
|
|
|
|
res.json({
|
|
|
|
status: 0,
|
|
|
|
msg: '',
|
|
|
|
data: term ? db.filter(function(item) {
|
2019-06-05 16:54:39 +08:00
|
|
|
return term ? ~item.label.indexOf(term) || ~item.value.indexOf(term) : false;
|
2019-04-30 11:11:25 +08:00
|
|
|
}) : db
|
|
|
|
});
|
|
|
|
}
|