mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-26 17:49:15 +01:00
加入自动搜索
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
v-model="scope.row.name"
|
||||
size="small"
|
||||
suffix-icon="el-icon-edit"
|
||||
:fetch-suggestions="querySearch"
|
||||
/>
|
||||
<el-input
|
||||
v-else-if="scope.row.type === 'spider'"
|
||||
@@ -174,6 +175,20 @@ export default {
|
||||
},
|
||||
onAdd () {
|
||||
this.paramData.push({ type: 'spider', name: '', value: '' })
|
||||
},
|
||||
querySearch (queryString, cb) {
|
||||
let data = this.$utils.scrapy.settingParamNames
|
||||
if (!queryString) {
|
||||
return cb(data.map(s => {
|
||||
return { value: s, label: s }
|
||||
}))
|
||||
}
|
||||
data = data
|
||||
.filter(s => s.match(new RegExp(queryString, 'i')))
|
||||
.sort((a, b) => a < b ? 1 : -1)
|
||||
cb(data.map(s => {
|
||||
return { value: s, label: s }
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user