|
@@ -2,7 +2,7 @@
|
|
<div class="country-select">
|
|
<div class="country-select">
|
|
<el-input
|
|
<el-input
|
|
v-model="productName"
|
|
v-model="productName"
|
|
- style="width: 240px"
|
|
|
|
|
|
+ clearable
|
|
placeholder="第一步:输入你的产品名称,选择目标区域市场"
|
|
placeholder="第一步:输入你的产品名称,选择目标区域市场"
|
|
/>
|
|
/>
|
|
<span class="country-wrap">
|
|
<span class="country-wrap">
|
|
@@ -13,16 +13,16 @@
|
|
<template #dropdown>
|
|
<template #dropdown>
|
|
<div class="custom-dropdown">
|
|
<div class="custom-dropdown">
|
|
<div class="custom-dropdown-filter">
|
|
<div class="custom-dropdown-filter">
|
|
- <el-input v-model="search" placeholder="Select Country">
|
|
|
|
|
|
+ <el-input v-model="search" clearable placeholder="Select Country">
|
|
<template #prefix>
|
|
<template #prefix>
|
|
- <el-icon class="el-input__icon"><search /></el-icon>
|
|
|
|
|
|
+ <img :src="SearchIcon" />
|
|
</template>
|
|
</template>
|
|
</el-input>
|
|
</el-input>
|
|
</div>
|
|
</div>
|
|
<div class="custom-dropdown-list">
|
|
<div class="custom-dropdown-list">
|
|
<el-dropdown-menu>
|
|
<el-dropdown-menu>
|
|
<el-dropdown-item
|
|
<el-dropdown-item
|
|
- v-for="item in countryList"
|
|
|
|
|
|
+ v-for="item in renderContryList"
|
|
:key="item.code"
|
|
:key="item.code"
|
|
@click="() => selectCountry(item)"
|
|
@click="() => selectCountry(item)"
|
|
>
|
|
>
|
|
@@ -43,8 +43,9 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
-import { reactive, ref } from 'vue';
|
|
|
|
|
|
+import { ComputedRef, ref, computed, onMounted } from 'vue';
|
|
import countryData from '../assets/country.json';
|
|
import countryData from '../assets/country.json';
|
|
|
|
+import SearchIcon from '../assets/images/Search.png';
|
|
|
|
|
|
import type { DropdownInstance } from 'element-plus';
|
|
import type { DropdownInstance } from 'element-plus';
|
|
|
|
|
|
@@ -55,7 +56,6 @@ interface countryItem {
|
|
}
|
|
}
|
|
|
|
|
|
const images = import.meta.glob('@/assets/flags/4x3/*.svg', { eager: true, import: 'default' });
|
|
const images = import.meta.glob('@/assets/flags/4x3/*.svg', { eager: true, import: 'default' });
|
|
-const step = ref<number>(1);
|
|
|
|
const productName = ref<string>('');
|
|
const productName = ref<string>('');
|
|
const search = ref<string>('');
|
|
const search = ref<string>('');
|
|
const countryList: countryItem[] = countryData.map((item) => ({
|
|
const countryList: countryItem[] = countryData.map((item) => ({
|
|
@@ -63,17 +63,25 @@ const countryList: countryItem[] = countryData.map((item) => ({
|
|
name: item.name,
|
|
name: item.name,
|
|
flag: images[`/src/assets/flags/4x3/${item.code}.svg`]
|
|
flag: images[`/src/assets/flags/4x3/${item.code}.svg`]
|
|
}));
|
|
}));
|
|
-const countryInfo = ref<countryItem>(countryList[0]);
|
|
|
|
|
|
+const renderContryList: ComputedRef<countryItem[]> = computed(() => {
|
|
|
|
+ return countryList.filter((item) => item.name.includes(search.value));
|
|
|
|
+});
|
|
|
|
+const countryInfo = ref<countryItem>(JSON.parse(JSON.stringify(countryList[0])));
|
|
const dropdown = ref<DropdownInstance>();
|
|
const dropdown = ref<DropdownInstance>();
|
|
|
|
|
|
const selectCountry = (item: countryItem) => {
|
|
const selectCountry = (item: countryItem) => {
|
|
countryInfo.value = item;
|
|
countryInfo.value = item;
|
|
};
|
|
};
|
|
|
|
|
|
-function showCountryList() {
|
|
|
|
|
|
+const showCountryList = () => {
|
|
if (!dropdown.value) return;
|
|
if (!dropdown.value) return;
|
|
dropdown.value.handleOpen();
|
|
dropdown.value.handleOpen();
|
|
-}
|
|
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+defineExpose({
|
|
|
|
+ getLocationName: () => countryInfo.value.name,
|
|
|
|
+ getProductName: () => productName.value
|
|
|
|
+});
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
<style lang="scss">
|
|
@@ -81,17 +89,36 @@ function showCountryList() {
|
|
.custom-dropdown {
|
|
.custom-dropdown {
|
|
display: flex;
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
- width: 240px;
|
|
|
|
- height: 400px;
|
|
|
|
- padding: 5px;
|
|
|
|
|
|
+ width: 280px;
|
|
|
|
+ height: 398px;
|
|
|
|
+ padding-left: 21px;
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
overflow: hidden;
|
|
overflow: hidden;
|
|
|
|
|
|
&-filter {
|
|
&-filter {
|
|
height: 48px;
|
|
height: 48px;
|
|
|
|
|
|
|
|
+ .el-input__prefix {
|
|
|
|
+ img {
|
|
|
|
+ width: 16px;
|
|
|
|
+ height: 16px;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .el-input__inner {
|
|
|
|
+ font-size: 16px;
|
|
|
|
+ color: #282e30;
|
|
|
|
+ &::placeholder {
|
|
|
|
+ font-weight: 400;
|
|
|
|
+ font-size: 16px;
|
|
|
|
+ color: rgba(40, 46, 48, 0.6);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
.el-input__wrapper {
|
|
.el-input__wrapper {
|
|
- height: 45px;
|
|
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: 100%;
|
|
|
|
+ box-shadow: none;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -100,23 +127,30 @@ function showCountryList() {
|
|
overflow: auto;
|
|
overflow: auto;
|
|
height: 100%;
|
|
height: 100%;
|
|
|
|
|
|
|
|
+ .el-dropdown-menu {
|
|
|
|
+ padding-top: 0 !important;
|
|
|
|
+ }
|
|
|
|
+
|
|
.el-dropdown-menu__item {
|
|
.el-dropdown-menu__item {
|
|
padding: 10px;
|
|
padding: 10px;
|
|
font-weight: 400;
|
|
font-weight: 400;
|
|
|
|
|
|
.country-name {
|
|
.country-name {
|
|
|
|
+ font-size: 16px;
|
|
color: #282e30;
|
|
color: #282e30;
|
|
text-overflow: ellipsis;
|
|
text-overflow: ellipsis;
|
|
overflow: hidden;
|
|
overflow: hidden;
|
|
white-space: nowrap;
|
|
white-space: nowrap;
|
|
|
|
|
|
&.active {
|
|
&.active {
|
|
- color: #036eb8;
|
|
|
|
|
|
+ color: var(--promotion--color-primary);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
img {
|
|
img {
|
|
width: 30px;
|
|
width: 30px;
|
|
- margin: 0 6px;
|
|
|
|
|
|
+ height: 24px;
|
|
|
|
+ margin-right: 7px;
|
|
|
|
+ // margin: 0 6px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -127,31 +161,28 @@ function showCountryList() {
|
|
.country-select {
|
|
.country-select {
|
|
display: flex;
|
|
display: flex;
|
|
align-items: center;
|
|
align-items: center;
|
|
- :deep(.el-input) {
|
|
|
|
- width: 25rem !important;
|
|
|
|
- height: 3rem !important;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- :deep(.el-input__inner) {
|
|
|
|
- &::placeholder {
|
|
|
|
- font-size: 1rem !important;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
.country-wrap {
|
|
.country-wrap {
|
|
|
|
+ width: 92px;
|
|
|
|
+ height: 68px;
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: center;
|
|
|
|
+ align-items: center;
|
|
|
|
+ background-color: #fff;
|
|
|
|
+ margin-left: 10px;
|
|
|
|
+
|
|
&-item {
|
|
&-item {
|
|
display: inline-flex;
|
|
display: inline-flex;
|
|
justify-content: center;
|
|
justify-content: center;
|
|
align-items: center;
|
|
align-items: center;
|
|
- width: 5.75rem;
|
|
|
|
- height: 4.25rem;
|
|
|
|
|
|
+ width: 72px;
|
|
|
|
+ height: 48px;
|
|
background-color: #ffffff;
|
|
background-color: #ffffff;
|
|
- margin-left: 0.625rem;
|
|
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
|
|
|
|
img {
|
|
img {
|
|
- width: 4.5rem;
|
|
|
|
|
|
+ // width: 4.5rem;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|