Skip to content
This repository was archived by the owner on Oct 22, 2024. It is now read-only.

Commit cc1a624

Browse files
committed
搜索时,自动定位第一项
1 parent 28c2468 commit cc1a624

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-bootstrap-selectpicker",
3-
"version": "1.0.5",
3+
"version": "1.0.6",
44
"description": "Vue component---vue-bootstrap-selectpicker",
55
"author": "long.woo <longwunet@outlook.com>",
66
"license": "MIT",

src/components/SelectPicker.vue

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<template>
22
<div class="dropdown bootstrap-select" :class="{ 'dropup': upShow, 'show': isOpen, 'disabled': ($attrs.disabled || $attrs.disabled === '') }">
3-
<div class="dropdown-toggle">
3+
<div class="dropdown-toggle d-flex">
4+
<!-- <div class="dropdown-badges">
5+
<span :class="['badge badge-pill', `badge-${badge}`]">{{value}}</span>
6+
</div> -->
47
<input class="form-control" type="text" :readonly="!search" :value="value" v-bind="$attrs" v-on="listeners">
58
</div>
69
<div class="dropdown-menu" ref="dropdownItemBox" :class="{ 'visibility': !dropdownRect.height }">
@@ -66,6 +69,12 @@ export default {
6669
6770
// 显示位置,仅支持`top`和`bottom`。如果没有设置,会根据页面高度计算;否则将以该值为准
6871
placement: String
72+
73+
// 多选时,badge类型(primary、secondary、success、danger、warning、info、light、dark)
74+
// badge: {
75+
// type: String,
76+
// default: 'primary'
77+
// }
6978
},
7079
computed: {
7180
// 如果配置项全部为`disabled`,禁止方向键选择
@@ -245,12 +254,17 @@ export default {
245254
}
246255
247256
this.filterData = newValue
248-
this.activeIndex = -1
257+
this.activeIndex = 0
249258
this.showDropdown()
250259
this.$emit('input', value)
251260
},
252261
253-
// 初始化
262+
// 初始化chooseData
263+
// _initChooseData () {
264+
// const value = this.value
265+
// const data = this.dr
266+
267+
// },
254268
255269
// 方向键上、下
256270
_selectArrow (arrow) {

src/pages/Propertys.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
<select-picker placeholder="请选择..." placement="top" :dropdown-data="baseDropdownData" v-model="noDefaultValue" @change="changeNoValueSelect" />
9191
<pre><code class="language-html">&lt;select-picker placement="top" /></code></pre>
9292
</div>
93-
<select-picker placeholder="输入关键字搜索..." search multiple :dropdown-data="baseDropdownData" v-model="testValue" @change="changeTest" />
93+
<!-- <select-picker placeholder="输入关键字搜索..." search multiple :dropdown-data="baseDropdownData" v-model="testValue" @change="changeTest" /> -->
9494
<h4>Propertys</h4>
9595
<div class="table-responsive">
9696
<table class="table table-bordered table-striped">

0 commit comments

Comments
 (0)