Commit 63a2249d by 胡悦

添加头部搜索

1 parent ec6f3c37
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-10-25 10:12:26 * @Date: 2022-10-25 10:12:26
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-17 11:47:03 * @LastEditTime: 2023-07-17 15:30:54
* @FilePath: \dj-data-view\src\components\ViewTitle.vue * @FilePath: \dj-data-view\src\components\ViewTitle.vue
* @Description: 页面头部组件 * @Description: 页面头部组件
--> -->
...@@ -74,7 +74,6 @@ export default { ...@@ -74,7 +74,6 @@ export default {
}, },
mounted() { mounted() {
this.timer() this.timer()
console.log(this.merchantList)
}, },
methods: { methods: {
timer() { timer() {
...@@ -93,16 +92,18 @@ export default { ...@@ -93,16 +92,18 @@ export default {
this.search = '' this.search = ''
}, },
async searchMerchant() { async searchMerchant() {
const _searchData = await this.api.solar.getMerchant({}) const _searchData = await this.api.solar.getMerchant({
merchantName: this.search
})
const _dataList = _searchData.data.dataList const _dataList = _searchData.data.dataList
_dataList.forEach(item => { _dataList.forEach(item => {
item.merchantname = item.merchantName item.merchantname = item.merchantName
}) })
this.merchantList = _dataList this.merchantList = _dataList
}, },
handleInput: utils.throttle(function(e) { handleInput: utils.debounce(function(e) {
this.searchMerchant() this.searchMerchant()
}, 2000 / 25), }, 1000 / 25),
clickOutside() { clickOutside() {
this.isShow = false this.isShow = false
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2023-07-05 15:11:53 * @Date: 2023-07-05 15:11:53
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-17 10:36:40 * @LastEditTime: 2023-07-17 15:30:16
--> -->
<template> <template>
<div v-click-outside="handleClickOutside" @mouseleave="handleMouseLeave" v-show="isShow" class="select-box" :style="{'width': boxWidth}"> <div v-click-outside="handleClickOutside" @mouseleave="handleMouseLeave" v-show="isShow" class="select-box" :style="{'width': boxWidth}">
...@@ -72,16 +72,9 @@ export default { ...@@ -72,16 +72,9 @@ export default {
empty: '暂无数据' empty: '暂无数据'
} }
}, },
watch: {
'dataList'(val) {
console.log(val)
}
},
mounted() { mounted() {
const { valueName, isObject, dataList, defaultValue } = this const { valueName, isObject, dataList, defaultValue } = this
console.log(defaultValue)
this.value = defaultValue || (isObject ? dataList[0][valueName] : dataList[0]) this.value = defaultValue || (isObject ? dataList[0][valueName] : dataList[0])
console.log(this.value)
}, },
methods: { methods: {
select(item) { select(item) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!