fix: 修改车辆日期选择框无法限制的问题
This commit is contained in:
parent
98b39610d4
commit
0dcad1dd74
@ -1,7 +1,7 @@
|
||||
//基础请求地址,需要根据自己的需求切换
|
||||
// 开发环境
|
||||
export const BASE_URL = "http://42.180.188.17:9809" // 鞍钢正式环境
|
||||
// export const BASE_URL = "http://42.180.188.17:19098" // 鞍钢线上测试环境
|
||||
// export const BASE_URL = "http://42.180.188.17:9809" // 鞍钢正式环境
|
||||
export const BASE_URL = "http://42.180.188.17:19098" // 鞍钢线上测试环境
|
||||
// export const BASE_URL = "http://47.93.215.234:9809" // 鞍钢正式环境(弃用)
|
||||
// export const BASE_URL = "http://47.93.215.234:19098" // 鞍钢线上测试环境(弃用)
|
||||
// export const BASE_URL = "http://47.93.215.234:19097"
|
||||
|
||||
@ -1,10 +1,14 @@
|
||||
<template>
|
||||
<view class="w-form-timePicker" hover-class="w-click-hover" v-if="!readonly">
|
||||
<template v-if="format.length > 9">
|
||||
<uni-datetime-picker v-if="format === 'yyyy-mm-dd hh:mm'" class="w-form-input"
|
||||
:border="false" type="datetime" :clear-icon="false" v-model="_value" />
|
||||
<uni-datetime-picker v-else class="w-form-input" :border="false" type="date" :clear-icon="false"
|
||||
v-model="_value" />
|
||||
<!-- <uni-datetime-picker v-if="format === 'yyyy-mm-dd hh:mm'" class="w-form-input" :border="false"
|
||||
type="datetime" :clear-icon="false" v-model="_value" ref="uniDateTime" @change="changeTime"/>
|
||||
<uni-datetime-picker v-else class="w-form-input" :border="false" type="date" ref="uniDateTime"
|
||||
:clear-icon="false" v-model="_value" @change="changeTime"/> -->
|
||||
<uni-datetime-picker v-if="format === 'yyyy-mm-dd hh:mm'" class="w-form-input" :border="false"
|
||||
type="datetime" :clear-icon="false" v-model="_value" ref="uniDateTime" @change="changeTime"/>
|
||||
<uni-datetime-picker v-else class="w-form-input" :border="false" type="date" ref="uniDateTime"
|
||||
:clear-icon="false" v-model="_value" @change="changeTime"/>
|
||||
<uni-icons type="right" :size="20" color="#999999"></uni-icons>
|
||||
</template>
|
||||
<template v-else-if="props.formProps.format === 'yyyy-mm'">
|
||||
@ -24,9 +28,13 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import {
|
||||
computed,
|
||||
watch,
|
||||
ref
|
||||
} from 'vue'
|
||||
import ClickInput from '@/components/ClickInput.vue'
|
||||
|
||||
const uniDateTime = ref();
|
||||
const props = defineProps({
|
||||
formProps: {
|
||||
type: Object,
|
||||
@ -37,7 +45,6 @@
|
||||
modelValue: String,
|
||||
readonly: Boolean
|
||||
})
|
||||
|
||||
const _value = computed({
|
||||
get() {
|
||||
return props.modelValue
|
||||
@ -49,7 +56,6 @@
|
||||
emits('update:modelValue', val)
|
||||
}
|
||||
})
|
||||
|
||||
const format = computed(() => {
|
||||
return (props.formProps.format || '').toLocaleLowerCase()
|
||||
})
|
||||
@ -89,9 +95,18 @@
|
||||
return [range.value[0].indexOf(props.modelValue)]
|
||||
}
|
||||
})
|
||||
|
||||
const emits = defineEmits(['update:modelValue'])
|
||||
|
||||
const timeVal = ref();
|
||||
const changeTime = (e) => {
|
||||
// 需要等到watch监听执行完才进行此操作
|
||||
setTimeout(function(){
|
||||
console.log(timeVal.value,222333)
|
||||
if(!props.modelValue){
|
||||
// uniDateTime.value.clear();
|
||||
uniDateTime.value.displayValue = ""
|
||||
}
|
||||
},100)
|
||||
}
|
||||
function timeChange(e) {
|
||||
const indexs = e.detail.value
|
||||
if (Array.isArray(indexs)) {
|
||||
@ -100,6 +115,11 @@
|
||||
_value.value = `${range.value[0][indexs]}`
|
||||
}
|
||||
}
|
||||
watch(() => props.modelValue, (newVal) => {
|
||||
timeVal.value = newVal;
|
||||
}, {
|
||||
deep: true
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
{
|
||||
"hash": "0f0fbf16",
|
||||
"configHash": "5bd87843",
|
||||
"lockfileHash": "33a33614",
|
||||
"browserHash": "a13cd6b4",
|
||||
"hash": "6ab18a53",
|
||||
"configHash": "87e744e2",
|
||||
"lockfileHash": "2ddd0eeb",
|
||||
"browserHash": "9b038b87",
|
||||
"optimized": {},
|
||||
"chunks": {}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user