1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <template>
- <view>
- <view class="searchSelect shadow" v-if="flag">
- <view class="cu-bar search bg-white">
- <view class="search-form round" style="margin-top:0">
- <input @focus="InputFocus" @blur="InputBlur" @input="handleInput()" v-model="searchInput"
- :adjust-position="false" type="text" placeholder="" confirm-type="search"
- style="border:none"></input>
- <!-- <text class="cuIcon-search "></text> -->
- </view>
- </view>
- <view class="select-items">
- <view class="select-item" v-for="(item,index) in searchList" @click="clickSelectItem(item,index)"
- :key="index">{{item}}</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: 'searchSelect',
- props: {
- flag: {
- type: Boolean,
- default: false
- },
- searchList: {
- type: Array,
- // default: []
- },
- searchList2: {
- type: Array,
- // default: []
- }
- },
- data() {
- return {
- searchInput: '',
- // flag: false,
- // searchList: [],
- // searchList2: [],
- }
- },
- onload() {
- this.getSearchList();
- },
- methods: {
- //请求
- async getSearchList(ming = {}) {
- const res = await this.$myRequest({
- url: 'Index/getSiteDropDownBox',
- data: ming
- })
- res.data.data.forEach(item => {
- this.searchList.push(item.siteName)
- this.searchList2.push(item.siteName)
- });
- },
- // 下拉选择
- clickSelectItem(item, index) {
- this.getSearchList({
- "siteName": item
- });
- this.flag = false
- },
- handleInput() {
- var newlist = this.searchList2.filter(item => item.indexOf(this.searchInput) > -1)
- this.searchList = newlist
- },
- InputFocus(e) {
- this.InputBottom = e.detail.height
- },
- InputBlur(e) {
- this.InputBottom = 0
- },
- changeTab(Inv) {
- that.navIdx = Inv;
- }
- }
- }
- </script>
- <style>
- </style>
|