Commit fbdb0587 by pangchong

fix: 修复onBeforeOpen

parent 2a406ef7
......@@ -132,11 +132,9 @@ const ps = defineProps({
default: '#165dff'
},
//打开前判断
beforeOpen: {
onBeforeOpen: {
type: Function,
default: () => {
return true
}
default: null
}
})
//获取下拉框样式
......@@ -172,11 +170,12 @@ const getPickerClass = computed(() => {
const show = ref(false)
//打开
const open = async () => {
const flag = await ps.beforeOpen()
if (flag) {
searchKey.value = ''
show.value = true
if (ps.onBeforeOpen) {
const flag = await ps.onBeforeOpen()
if (!flag) return
}
searchKey.value = ''
show.value = true
}
//设置下拉框打开的默认值
const defaultIndex = ref(0)
......
......@@ -118,7 +118,7 @@
:options="relatedSeatSet"
clearable
filter
:beforeOpen="beforeOpen"
:onBeforeOpen="onBeforeOpen"
label-field="seatName"
value-field="id"
></global-picker>
......@@ -133,7 +133,7 @@ import useBaseStore from 'mocp/store/base'
import { getParamsByType } from 'mocp/hooks/use-params/useParams'
import { useGetDictByValue } from 'mocp/hooks/use-dict/useDict'
import { formData, formRef, relatedSeatSet, rules } from './constants/add.compositions'
import { beforeOpen, changeAc, handleSubmit } from './constants/add.functionals'
import { onBeforeOpen, changeAc, handleSubmit } from './constants/add.functionals'
import useUserStore from 'mocp/store/user'
const baseStore = useBaseStore()
......
......@@ -13,7 +13,7 @@ export const changeAc = async () => {
}
}
//选择相关席位
export const beforeOpen = async () => {
export const onBeforeOpen = async () => {
if (!formData.machineNumber) {
uni.$mocpMessage.error('请选择机号')
return false
......
......@@ -37,7 +37,6 @@
align-items: center;
justify-content: space-between;
.txt {
color: $mocp-text-5;
font-size: 28rpx;
margin-left: 16rpx;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment