|
|
@@ -16,9 +16,10 @@
|
|
|
:placeholder="placeholderByType"
|
|
|
@focus.stop.prevent="onFocus()"
|
|
|
@blur.stop.prevent="onBlur()"
|
|
|
+ @keyup.13="onSearch()"
|
|
|
@keyup.40="onSelectChange(1)"
|
|
|
@keyup.38="onSelectChange(-1)"
|
|
|
- @keyup.13="onSearch()"/>
|
|
|
+ />
|
|
|
<span class="input-group-btn" @click="onSearch()" style="z-index: 10">
|
|
|
<button class="btn btn-primary search-btn" type="button" :class="{'Isblue':!SelectItem}">搜 索</button>
|
|
|
</span>
|
|
|
@@ -39,7 +40,8 @@
|
|
|
:class="{'association2': !SelectItem, 'pcb-asso': isPcb}"
|
|
|
v-show="showAssociate"
|
|
|
@mouseenter="associate.focus=true"
|
|
|
- @mouseleave="associate.focus=false">
|
|
|
+ @mouseleave="associate.focus=false"
|
|
|
+ >
|
|
|
<li v-for="(v, index) in similarKeywords.result" class="item"
|
|
|
:class="{'active': index==associate.activeIndex}"
|
|
|
@click.stop.prevent="onAssociateClick(v.value)">{{v.value}}
|
|
|
@@ -198,7 +200,7 @@
|
|
|
'keyword': {
|
|
|
handler (val, oldVal) {
|
|
|
let keywords = this.similarKeywords
|
|
|
- if (!keywords.result || !keywords.result.length || this.associate.activeIndex === null || val !== keywords[this.associate.activeIndex]) {
|
|
|
+ if (!keywords.result || !keywords.result.length || this.associate.activeIndex === null || val !== keywords.result[this.associate.activeIndex].value) {
|
|
|
this.onChange()
|
|
|
}
|
|
|
}
|
|
|
@@ -230,20 +232,21 @@
|
|
|
this.associate.show = this.associate.focus
|
|
|
},
|
|
|
onSelectChange (count) {
|
|
|
+ console.log(1)
|
|
|
let keywords = this.similarKeywords
|
|
|
- if (keywords && keywords.length) {
|
|
|
+ if (keywords && keywords.result.length) {
|
|
|
let index = this.associate.activeIndex
|
|
|
if (index === null) {
|
|
|
index = -1
|
|
|
}
|
|
|
index += count
|
|
|
- if (index >= keywords.length) {
|
|
|
+ if (index >= keywords.result.length) {
|
|
|
index = 0
|
|
|
} else if (index < 0) {
|
|
|
- index = keywords.length - 1
|
|
|
+ index = keywords.result.length - 1
|
|
|
}
|
|
|
this.associate.activeIndex = index
|
|
|
- this.keyword = keywords[index]
|
|
|
+ this.keyword = keywords.result[index].value || keywords.result[index].code || keywords.result[index].nameCn || keywords.result[index].name
|
|
|
}
|
|
|
},
|
|
|
onChange () {
|