Files
crm-uni/components/select/select.vue
T
浅念 5e8e44f88f Squashed commit of the following:
commit f9e9899e0e
Author: 浅念 <email@sample.com>
Date:   Fri Mar 28 11:10:56 2025 +0800

    设置默认语言为英语

commit 303121ba81
Author: 浅念 <email@sample.com>
Date:   Fri Mar 28 11:00:05 2025 +0800

    调用接口调整

commit 37e0e55d96
Author: 浅念 <email@sample.com>
Date:   Fri Mar 28 10:33:48 2025 +0800

    线上接口地址

commit 11dd7de521
Author: 浅念 <email@sample.com>
Date:   Thu Mar 27 16:54:52 2025 +0800

    修改样式

commit 8ceb98b321
Author: 浅念 <email@sample.com>
Date:   Thu Mar 27 16:47:04 2025 +0800

    隐藏我的名片

commit f58e712684
Author: 浅念 <email@sample.com>
Date:   Thu Mar 27 16:44:43 2025 +0800

    样式调整

commit 54ad6c9e37
Author: 浅念 <email@sample.com>
Date:   Thu Mar 27 16:35:21 2025 +0800

    修改语言包

commit 526f934a75
Author: 浅念 <email@sample.com>
Date:   Thu Mar 27 16:13:47 2025 +0800

    标签功能

commit 8583ff2543
Author: 浅念 <email@sample.com>
Date:   Wed Mar 26 17:02:04 2025 +0800

    标签管理页面

commit be8674fd51
Author: 浅念 <email@sample.com>
Date:   Tue Mar 25 17:29:37 2025 +0800

    样式调整

commit a5d5ce4e7c
Author: 浅念 <email@sample.com>
Date:   Tue Mar 25 17:23:40 2025 +0800

    倒计时组件

commit f88048b876
Author: 浅念 <email@sample.com>
Date:   Tue Mar 25 17:19:43 2025 +0800

    首页添加跟进提醒

commit f9a39d5aaa
Author: 浅念 <email@sample.com>
Date:   Tue Mar 25 13:13:39 2025 +0800

    提交

commit e3abe0bf18
Author: 浅念 <email@sample.com>
Date:   Tue Mar 25 13:12:24 2025 +0800

    名片部分页面。地图定位。国家下拉搜索  回收站
2025-03-28 14:46:49 +08:00

125 lines
2.4 KiB
Vue

<template>
<view>
<view class="text">
<view class="qx" @click="close('showarea') ">{{$t('cancel')}}</view>
<view class="qd" @click="arerfn">{{$t('confirm')}}</view>
</view>
<view class="popup-content">
<!-- 搜索框 -->
<u-input
v-model="searchKeyword"
:placeholder="$t('keyword')"
@input="handleSearch"
></u-input>
<!-- 选项列表 -->
<scroll-view scroll-y class="option-list">
<view
v-for="(item, index) in areaList"
:key="index"
class="option-item"
@click="handleSelect(item)"
:class="actives==item.id?'actives':''"
>
{{ item.name }}
</view>
<view v-if="filteredOptions.length === 0" class="no-data">
{{$t('noresults')}}
</view>
</scroll-view>
</view>
</view>
</template>
<script>
export default {
name:"select",
props: {
showarea: {
type: Boolean,
default: true
},
areaList:[],
},
data() {
return {
searchKeyword:'',
filteredOptions:'',
};
},
methods:{
// 搜索处理函数
handleSearch(){
if (this.searchKeyword) {
console.log(this.searchKeyword)
this.filteredOptions = this.areaList.filter((item) =>
item.name.includes(this.searchKeyword)
);
console.log(this.filteredOptions)
} else {
// 如果搜索框为空,显示全部数据
this.filteredOptions = this.areaList;
}
},
// 选择选项
handleSelect(item) {
this.selectedLabel = item.name; // 回显选中的值
// this.searchKeyword = item.name
this.actives = item.id
// this.showPicker = false; // 关闭弹窗
console.log("选中的值:", item.id);
console.log("选中的值:", item.name);
},
arerfn(){
this.showPicker = false; // 关闭弹窗
this.country_name = this.selectedLabel
this.userinfo.country_id = this.actives
},
close(val){
this[val] = false
},
}
}
</script>
<style lang="scss">
.actives{
background-color: #dfdfdf;
}
.text{
display: flex;
align-items: center;
justify-content: space-between;
line-height: 30px;
padding: 10px 15px 0px;
.qd{
color: #3471FF;
}
}
.popup-content {
padding: 20px;
background-color: #fff;
}
.option-list {
max-height: 400rpx;
margin-top: 20rpx;
}
.option-item {
padding: 20rpx;
border-bottom: 1rpx solid #eee;
}
.option-item:last-child {
border-bottom: none;
}
.no-data {
text-align: center;
padding: 20rpx;
color: #999;
}
</style>