diff --git a/src/lang/en.ts b/src/lang/en.ts index 17e8e2c..56d5246 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -1,33 +1,40 @@ export default { - Login: { - - }, - Input: { - placeholder: 'Please input', - selectPlaceholder: 'Please select', - type: 'Type', - area: 'Region', - style: 'Style', - types: { - sofa: 'Sofa', - desk: 'Desk', - chair: 'Chair' - }, - styles: { - modern: 'Modern', - classic: 'Classic' - } - }, - area: { - unitedStates: 'United States', - singapore: 'Singapore', - australia: 'Australia', - southKorea: 'South Korea', - china: 'China', - italy: 'Italy', - france: 'France', - japan: 'Japan', - canada: 'Canada', - germany: 'Germany' - } + Login: {}, + Input: { + placeholder: 'Please input', + selectPlaceholder: 'Please select', + typePlaceholder: 'Type', + areaPlaceholder: 'Region', + stylePlaceholder: 'Style', + types: { + sofa: 'Sofa', + desk: 'Desk', + chair: 'Chair' + }, + styles: { + Coastal: 'Coastal', + Verdant: 'Verdant', + Traditional: 'Traditional', + CenturyChrome: 'Century\nChrome', + ModernRevival: 'Modern\nRevival', + Tuscan2000s: "Tuscan\n2000's", + Bauhaus: 'Bauhaus', + Constructivism: 'Constructivism', + NordicNoir:'Nordic\nNoir', + }, + chooseStyle: 'Choose Style', + confirm: 'Confirm' + }, + area: { + unitedStates: 'United States', + singapore: 'Singapore', + australia: 'Australia', + southKorea: 'South Korea', + china: 'China', + italy: 'Italy', + france: 'France', + japan: 'Japan', + canada: 'Canada', + germany: 'Germany' + } } diff --git a/src/lang/zh-cn.ts b/src/lang/zh-cn.ts index f78f32a..f7b7fe8 100644 --- a/src/lang/zh-cn.ts +++ b/src/lang/zh-cn.ts @@ -16,7 +16,9 @@ export default { styles: { modern: '现代', classic: '古典' - } + }, + chooseStyle: '选择风格', + confirm: '确认' }, area: { unitedStates: '美国', diff --git a/src/views/home/components/Input.vue b/src/views/home/components/Input.vue index cd3e51d..3e51cfa 100644 --- a/src/views/home/components/Input.vue +++ b/src/views/home/components/Input.vue @@ -10,7 +10,7 @@
- + - + - - + - + + + +
+
{{ $t('Input.chooseStyle') }}
+
+
+ {{ $t(item.label) }} +
+
+ +
+
+ @@ -45,11 +75,41 @@ import { computed, ref } from 'vue' import { areaList } from '@/utils/area' +const styleKeys: string[] = [ + 'Coastal', + 'Verdant', + 'Traditional', + 'CenturyChrome', + 'ModernRevival', + 'Tuscan2000s', + 'Bauhaus', + 'Constructivism', + 'NordicNoir' +] + const inputValue = ref('') const typeValue = ref('') const areaValue = ref('') const styleValue = ref('') +const tempSelectedValue = ref('') +const stylePopupVisible = ref(false) + +const openStylePopup = () => { + // 打开弹窗时初始化临时选中值为当前选中值 + tempSelectedValue.value = styleValue.value + stylePopupVisible.value = true +} + +const selectStyle = (value: string) => { + tempSelectedValue.value = value +} + +const confirmStyle = () => { + // 点击确认后才真正赋值 + styleValue.value = tempSelectedValue.value + stylePopupVisible.value = false +} const typeOptions = ref([ { label: 'Input.types.sofa', @@ -65,16 +125,12 @@ const typeOptions = ref([ } ]) const areaOptions = ref(areaList) -const styleOptions = ref([ - { - label: 'Input.styles.modern', - value: 'Modern' - }, - { - label: 'Input.styles.classic', - value: 'Classic' - } -]) +const styleOptions = ref( + styleKeys.map((key) => ({ + label: `Input.styles.${key}`, + value: key + })) +) + +