<script setup>
import {edbFrequencyOpts} from '../util/config'

const frequencyOpts=edbFrequencyOpts.map(item=>{return{text:item,value:item}})

const props=defineProps({
    show:{
        type:Boolean,
        default:false
    },
})

const emits=defineEmits(['update:show','select'])

function handleClose(){
    emits('update:show',false)
}
function onConfirmSelectFrequency(e){
    const value=e.selectedValues[0]
    emits('select',value)
    handleClose()
}

</script>

<template>
    <van-popup 
        :show="props.show" 
        round 
        position="bottom"
    >
        <van-picker
            title="请选择频度"
            :columns="frequencyOpts"
            @cancel="handleClose"
            @confirm="onConfirmSelectFrequency"
        />
    </van-popup>
</template>