add:新增下拉选项
This commit is contained in:
1 parent
8fb10e481f
commit
149b89d636
1 file changed
+29
-10
@@ -15,9 +15,21 @@ const emits = defineEmits<{
|
|||||||
back: [void]
|
back: [void]
|
||||||
step: [number]
|
step: [number]
|
||||||
}>()
|
}>()
|
||||||
const step = ref(0)
|
const step = ref<number>(0)
|
||||||
const addPage = ref(1)
|
const addPage = ref<number>(1)
|
||||||
const isUserPage = ref(false)
|
const isUserPage = ref<boolean>(false)
|
||||||
|
const aimList = ref<string[]>(['增肥', '减肥'])
|
||||||
|
const aimIndex = ref<number>(0)
|
||||||
|
const weightList = ref<string[]>(['6kg', '7kg'])
|
||||||
|
const weightIndex = ref<number>(0)
|
||||||
|
function handleAimChange(e: CustomEvent, type: string) {
|
||||||
|
if (type === 'aim') {
|
||||||
|
aimIndex.value = e.detail.value
|
||||||
|
}
|
||||||
|
else if (type === 'weight') {
|
||||||
|
weightIndex.value = e.detail.value
|
||||||
|
}
|
||||||
|
}
|
||||||
const progressNumber = computed<number>(() => {
|
const progressNumber = computed<number>(() => {
|
||||||
return Math.ceil((step.value + 1) / (props.list.length + addPage.value) * 100)
|
return Math.ceil((step.value + 1) / (props.list.length + addPage.value) * 100)
|
||||||
})
|
})
|
||||||
@@ -76,20 +88,27 @@ function handleAnswer(answer: PetCard) {
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="w-[calc(100% - 32px)] mx-[16px] h-[56px] bg-[white] rounded-t-3 mt-4 flex items-center card_border_bottom p-4 justify-between">
|
<view class="w-[calc(100% - 32px)] mx-[16px] h-[56px] bg-[white] rounded-t-3 mt-4 flex items-center card_border_bottom p-4 justify-between">
|
||||||
<view>喂养目标</view>
|
<view class="whitespace-nowrap">
|
||||||
|
喂养目标
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="flex justify-center items-center">
|
<view class="flex justify-center items-center">
|
||||||
<text class="mr-3">
|
<picker :value="aimIndex" :range="aimList" @change="handleAimChange($event, 'aim')">
|
||||||
增肥
|
<view class="uni-input">
|
||||||
</text>
|
{{ aimList[aimIndex] }}
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
<image :src="right" class="w-[24px] h-[24px]" />
|
<image :src="right" class="w-[24px] h-[24px]" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="w-[calc(100% - 32px)] mx-[16px] h-[56px] bg-[white] rounded-b-3 flex items-center p-4 justify-between">
|
<view class="w-[calc(100% - 32px)] mx-[16px] h-[56px] bg-[white] rounded-b-3 flex items-center p-4 justify-between">
|
||||||
<view>目标体重</view>
|
<view>目标体重</view>
|
||||||
<view class="flex justify-center items-center">
|
<view class="flex justify-center items-center">
|
||||||
<text class="mr-3">
|
<picker :value="weightIndex" :range="weightList" @change="handleAimChange($event, 'weight')">
|
||||||
6kg
|
<view class="uni-input">
|
||||||
</text>
|
{{ weightList[weightIndex] }}
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
<image :src="right" class="w-[24px] h-[24px]" />
|
<image :src="right" class="w-[24px] h-[24px]" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
Reference in new issue
Block a user