uview-plus组件库全面升级更新,订单结算判断支付方式是否可用代码调整,公众号关注二维码修改
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
* @lastTime : 2021-08-20 16:57:48
|
||||
* @FilePath : /u-view2.0/uview-ui/libs/config/props/datetimePicker.js
|
||||
*/
|
||||
import { t } from '../../libs/i18n'
|
||||
export default {
|
||||
// datetimePicker 组件
|
||||
datetimePicker: {
|
||||
@@ -26,12 +27,18 @@ export default {
|
||||
formatter: null,
|
||||
loading: false,
|
||||
itemHeight: 44,
|
||||
cancelText: '取消',
|
||||
confirmText: '确认',
|
||||
cancelText: t("up.common.cancel"),
|
||||
confirmText: t("up.common.confirm"),
|
||||
cancelColor: '#909193',
|
||||
confirmColor: '#3c9cff',
|
||||
visibleItemCount: 5,
|
||||
closeOnClickOverlay: false,
|
||||
defaultIndex: []
|
||||
defaultIndex: [],
|
||||
inputBorder: 'surround',
|
||||
disabled: false,
|
||||
disabledColor: '',
|
||||
placeholder: t("up.common.pleaseChoose"),
|
||||
inputProps: {},
|
||||
pageInline: false
|
||||
}
|
||||
}
|
||||
|
||||
7
uni_modules/uview-plus/components/u-datetime-picker/dayjs.esm.min.js
vendored
Normal file
7
uni_modules/uview-plus/components/u-datetime-picker/dayjs.esm.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -5,15 +5,29 @@ export const props = defineMixin({
|
||||
// 是否显示input
|
||||
hasInput: {
|
||||
type: Boolean,
|
||||
default: () => false
|
||||
default: false
|
||||
},
|
||||
inputProps: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
inputBorder: {
|
||||
type: String,
|
||||
default: () => defProps.input.inputBorder
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: () => false
|
||||
default: () => defProps.input.disabled
|
||||
},
|
||||
disabledColor:{
|
||||
type: String,
|
||||
default: () => defProps.input.disabledColor
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: () => '请选择'
|
||||
default: () => defProps.input.placeholder
|
||||
},
|
||||
format: {
|
||||
type: String,
|
||||
@@ -149,6 +163,11 @@ export const props = defineMixin({
|
||||
defaultIndex: {
|
||||
type: Array,
|
||||
default: () => defProps.datetimePicker.defaultIndex
|
||||
},
|
||||
// 是否页面内展示
|
||||
pageInline:{
|
||||
type: Boolean,
|
||||
default: () => defProps.datetimePicker.pageInline
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,23 +1,21 @@
|
||||
<template>
|
||||
<view class="u-datetime-picker">
|
||||
<view v-if="hasInput" class="u-datetime-picker__has-input"
|
||||
@click="onShowByClickInput"
|
||||
@click="onShowByClickInput"
|
||||
>
|
||||
<slot name="trigger" :value="inputValue">
|
||||
<up-input
|
||||
:placeholder="placeholder"
|
||||
:readonly="!!showByClickInput"
|
||||
border="surround"
|
||||
v-model="inputValue"
|
||||
:disabled="disabled"
|
||||
v-bind="inputPropsInner"
|
||||
></up-input>
|
||||
<div class="input-cover">
|
||||
</div>
|
||||
<cover-view class="input-cover">
|
||||
</cover-view>
|
||||
</slot>
|
||||
</view>
|
||||
<u-picker
|
||||
ref="picker"
|
||||
:show="show || (hasInput && showByClickInput)"
|
||||
:show="pageInline || show || (hasInput && showByClickInput)"
|
||||
:popupMode="popupMode"
|
||||
:closeOnClickOverlay="closeOnClickOverlay"
|
||||
:columns="columns"
|
||||
@@ -31,6 +29,7 @@
|
||||
:cancelColor="cancelColor"
|
||||
:confirmColor="confirmColor"
|
||||
:toolbarRightSlot="toolbarRightSlot"
|
||||
:pageInline="pageInline"
|
||||
@close="close"
|
||||
@cancel="cancel"
|
||||
@confirm="confirm"
|
||||
@@ -60,7 +59,7 @@
|
||||
import { props } from './props';
|
||||
import { mpMixin } from '../../libs/mixin/mpMixin';
|
||||
import { mixin } from '../../libs/mixin/mixin';
|
||||
import dayjs from 'dayjs/esm/index';
|
||||
import dayjs from './dayjs.esm.min.js';
|
||||
import { range, error, padZero } from '../../libs/function/index';
|
||||
import test from '../../libs/function/test';
|
||||
/**
|
||||
@@ -111,6 +110,12 @@
|
||||
watch: {
|
||||
show(newValue, oldValue) {
|
||||
if (newValue) {
|
||||
// #ifdef VUE3
|
||||
this.innerValue = this.correctValue(this.modelValue)
|
||||
// #endif
|
||||
// #ifdef VUE2
|
||||
this.innerValue = this.correctValue(this.value)
|
||||
// #endif
|
||||
this.updateColumnValue(this.innerValue)
|
||||
}
|
||||
},
|
||||
@@ -133,7 +138,17 @@
|
||||
computed: {
|
||||
// 如果以下这些变量发生了变化,意味着需要重新初始化各列的值
|
||||
propsChange() {
|
||||
return [this.mode, this.maxDate, this.minDate, this.minHour, this.maxHour, this.minMinute, this.maxMinute, this.filter, ]
|
||||
return [this.mode, this.maxDate, this.minDate, this.minHour, this.maxHour, this.minMinute, this.maxMinute, this.filter, this.modelValue]
|
||||
},
|
||||
// input的props
|
||||
inputPropsInner() {
|
||||
return {
|
||||
border: this.inputBorder,
|
||||
placeholder: this.placeholder,
|
||||
disabled: this.disabled,
|
||||
disabledColor: this.disabledColor,
|
||||
...this.inputProps
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -162,6 +177,9 @@
|
||||
case 'year-month':
|
||||
format = 'YYYY-MM'
|
||||
break;
|
||||
case 'datehour':
|
||||
format = 'YYYY-MM-DD HH'
|
||||
break;
|
||||
case 'datetime':
|
||||
format = 'YYYY-MM-DD HH:mm'
|
||||
break;
|
||||
@@ -428,7 +446,10 @@
|
||||
},
|
||||
// 根据minDate、maxDate、minHour、maxHour等边界值,判断各列的开始和结束边界值
|
||||
getBoundary(type, innerValue) {
|
||||
const value = new Date(innerValue)
|
||||
let value = new Date(innerValue)
|
||||
if(isNaN(value.getTime())){
|
||||
value = new Date()
|
||||
}
|
||||
const boundary = new Date(this[`${type}Date`])
|
||||
const year = dayjs(boundary).year()
|
||||
let month = 1
|
||||
@@ -467,14 +488,13 @@
|
||||
if(!this.disabled){
|
||||
this.showByClickInput = !this.showByClickInput
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '../../libs/css/components.scss';
|
||||
.u-datetime-picker {
|
||||
flex: 1;
|
||||
&__has-input {
|
||||
|
||||
Reference in New Issue
Block a user