提交 92ca6978 作者: 方治民

fix: 修复一些组件 Bug

上级 9071246e
...@@ -337,4 +337,4 @@ ...@@ -337,4 +337,4 @@
} }
</script> </script>
<style scoped></style> <style scoped></style>
\ No newline at end of file
...@@ -104,6 +104,21 @@ ...@@ -104,6 +104,21 @@
watch: { watch: {
open(val) { open(val) {
this.isOpen = val this.isOpen = val
},
isOpen(val) {
this.$nextTick(async () => {
let parent = this.$parent;
let parentName = parent.$options.name;
while (parentName !== 'PageBody') {
if (parentName === 'fui-collapse-item') {
await parent.init()
}
parent = parent.$parent;
if (!parent) return false;
parentName = parent.$options.name;
}
})
} }
}, },
updated(e) { updated(e) {
...@@ -136,12 +151,14 @@ ...@@ -136,12 +151,14 @@
}, },
methods: { methods: {
init() { init() {
const promise = []
// #ifndef APP-NVUE // #ifndef APP-NVUE
this.getCollapseHeight() promise.push(this.getCollapseHeight())
// #endif // #endif
// #ifdef APP-NVUE // #ifdef APP-NVUE
this.getNvueHeight() promise.push(this.getNvueHeight())
// #endif // #endif
return Promise.all(promise)
}, },
uninstall() { uninstall() {
if (this.collapse) { if (this.collapse) {
...@@ -165,41 +182,49 @@ ...@@ -165,41 +182,49 @@
} }
}, },
getCollapseHeight(index = 0) { getCollapseHeight(index = 0) {
uni.createSelectorQuery() return new Promise((resolve) => {
// #ifndef MP-ALIPAY uni.createSelectorQuery()
.in(this) // #ifndef MP-ALIPAY
// #endif .in(this)
.select(`#${this.elId}`)
.fields({
size: true
}, data => {
if (index >= 10) return
if (!data) {
index++
this.getCollapseHeight(index)
return
}
// #ifdef APP-NVUE
this.height = data.height + 1
// #endif
// #ifndef APP-NVUE
this.height = data.height
// #endif // #endif
this.isHeight = true .select(`#${this.elId}`)
}) .fields({
.exec() size: true
}, data => {
if (index >= 10) return
if (!data) {
index++
this.getCollapseHeight(index)
return
}
// #ifdef APP-NVUE
this.height = data.height + 1
// #endif
// #ifndef APP-NVUE
this.height = data.height
// #endif
this.isHeight = true
resolve(this.height)
})
.exec()
})
}, },
getNvueHeight() { getNvueHeight() {
const result = dom.getComponentRect(this.$refs['fui_collapse__el'], option => { return new Promise((resolve) => {
if (option && option.result && option.size) { const result = dom.getComponentRect(this.$refs['fui_collapse__el'], option => {
// #ifdef APP-NVUE if (option && option.result && option.size) {
this.height = option.size.height + 1 // #ifdef APP-NVUE
// #endif this.height = option.size.height + 1
// #ifndef APP-NVUE // #endif
this.height = option.size.height // #ifndef APP-NVUE
// #endif this.height = option.size.height
this.isHeight = true // #endif
} this.isHeight = true
resolve(this.height)
}
})
}) })
}, },
getCollapse(name = 'fui-collapse') { getCollapse(name = 'fui-collapse') {
...@@ -340,4 +365,4 @@ ...@@ -340,4 +365,4 @@
.fui-collapse__content-open { .fui-collapse__content-open {
position: relative; position: relative;
} }
</style> </style>
\ No newline at end of file
...@@ -522,9 +522,10 @@ ...@@ -522,9 +522,10 @@
this.reset(); this.reset();
this.getDefaultOptions(this.value) this.getDefaultOptions(this.value)
this.handleDate() this.handleDate()
setTimeout(() => { // this.initData()
// setTimeout(() => {
this.initData() this.initData()
}, 50) // }, 50)
}, },
btnCancel(e) { btnCancel(e) {
// #ifdef APP-NVUE // #ifdef APP-NVUE
...@@ -626,8 +627,8 @@ ...@@ -626,8 +627,8 @@
return new Date(date.replace(/\-/g, '/')) return new Date(date.replace(/\-/g, '/'))
}, },
handleDate() { handleDate() {
const min = this.toDate(this.minDate, '2010-01-01'); const min = this.toDate(this.minDate, '2010-01-01 00:00:00');
const max = this.toDate(this.maxDate, '2030-12-31'); const max = this.toDate(this.maxDate, '2050-12-31 23:59:59');
this.minArr = [min.getFullYear(), min.getMonth() + 1, min.getDate(), min.getHours(), min.getMinutes(), min this.minArr = [min.getFullYear(), min.getMonth() + 1, min.getDate(), min.getHours(), min.getMinutes(), min
.getSeconds() .getSeconds()
]; ];
...@@ -651,6 +652,7 @@ ...@@ -651,6 +652,7 @@
max = this.maxArr[1] max = this.maxArr[1]
} }
max = max < min ? min : max max = max < min ? min : max
// min = this.minArr[1]
this.months = this.toArray(min, max); this.months = this.toArray(min, max);
}, },
getDays(index, idx) { getDays(index, idx) {
...@@ -663,24 +665,42 @@ ...@@ -663,24 +665,42 @@
} else if (year == this.maxArr[0] && month == this.maxArr[1]) { } else if (year == this.maxArr[0] && month == this.maxArr[1]) {
max = this.maxArr[2] max = this.maxArr[2]
} }
// min = this.minArr[2]
max = !max || max < min ? min : max max = !max || max < min ? min : max
this.days = this.toArray(min, max); this.days = this.toArray(min, max);
}, },
getHours() { getHours(index,mindex,dindex) {
let year = this.years[index]
let month = this.months[mindex]
let days = this.days[dindex]
let range = this.hourRange || [0, 23]; let range = this.hourRange || [0, 23];
let min = Number(range[0] || 0); let min = Number(range[0] || 0);
let max = Number(range[1] || 23); let max = Number(range[1] || 23);
min = Math.floor(min < 0 || min > 23 ? 0 : min); min = Math.floor(min < 0 || min > 23 ? 0 : min);
max = Math.floor(max < 0 || max > 23 ? 23 : max); max = Math.floor(max < 0 || max > 23 ? 23 : max);
if (year == this.minArr[0] && month == this.minArr[1] && days == this.minArr[2]) {
min = this.minArr[3]
} else if (year == this.maxArr[0] && month == this.maxArr[1] && days == this.minArr[2]) {
max = this.maxArr[3]
}
max = max < min ? min : max max = max < min ? min : max
this.hours = this.toArray(min, max); this.hours = this.toArray(min, max);
}, },
getMinutes() { getMinutes(index,mindex,dindex,hindex) {
let year = this.years[index]
let month = this.months[mindex]
let days = this.days[dindex]
let hours = this.hours[hindex]
let range = this.minuteRange || [0, 59]; let range = this.minuteRange || [0, 59];
let min = Number(range[0] || 0); let min = Number(range[0] || 0);
let max = Number(range[1] || 59); let max = Number(range[1] || 59);
min = Math.floor(min < 0 || min > 59 ? 0 : min); min = Math.floor(min < 0 || min > 59 ? 0 : min);
max = Math.floor(max < 0 || max > 59 ? 59 : max); max = Math.floor(max < 0 || max > 59 ? 59 : max);
if (year == this.minArr[0] && month == this.minArr[1] && days == this.minArr[2] && hours == this.minArr[3]) {
min = this.minArr[4]
} else if (year == this.maxArr[0] && month == this.maxArr[1] && days == this.minArr[2] && hours == this.minArr[3]) {
max = this.maxArr[4]
}
max = max < min ? min : max max = max < min ? min : max
this.minutes = this.toArray(min, max); this.minutes = this.toArray(min, max);
}, },
...@@ -711,11 +731,11 @@ ...@@ -711,11 +731,11 @@
type > 2 && this.getDays(index, idx); type > 2 && this.getDays(index, idx);
} }
} }
type > 3 && type < 8 && this.getHours() type > 3 && type < 8 && this.getHours(0,0,0)
type > 4 && this.getMinutes() type > 4 && this.getMinutes(0,0,0,0)
type > 6 && this.getSeconds() type > 6 && this.getSeconds()
this.$nextTick(() => { this.$nextTick(() => {
setTimeout(() => { // setTimeout(() => {
let di = this.getIndex(this.days, this.values[2]); let di = this.getIndex(this.days, this.values[2]);
let hi = this.getIndex(this.hours, this.values[3]); let hi = this.getIndex(this.hours, this.values[3]);
let mi = this.getIndex(this.minutes, this.values[4]) let mi = this.getIndex(this.minutes, this.values[4])
...@@ -730,7 +750,7 @@ ...@@ -730,7 +750,7 @@
[hi, mi, si], [hi, mi, si],
[mi, si] [mi, si]
][type - 1] ][type - 1]
}, 50) // }, 50)
}) })
}, },
getResult() { getResult() {
...@@ -885,9 +905,12 @@ ...@@ -885,9 +905,12 @@
if (type > 2) { if (type > 2) {
this.getDays(value[0], value[1]) this.getDays(value[0], value[1])
} }
} else if (value[1] != this.vals[1] && type > 2) { } else if (value[1] != this.vals[1] && type > 2) {
this.getDays(value[0], value[1]) this.getDays(value[0], value[1])
} }
this.getHours(value[0], value[1],value[2])
this.getMinutes(value[0], value[1],value[2],value[3])
} }
this.vals = value; this.vals = value;
if (this.range) { if (this.range) {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<view class="fui-input__required" :style="{color:requiredColor}" v-if="required">*</view> <view class="fui-input__required" :style="{color:requiredColor}" v-if="required">*</view>
<!-- #endif --> <!-- #endif -->
<view class="fui-input__label" :style="{minWidth:labelWidth+'rpx'}" v-if="label"> <view class="fui-input__label" :style="{minWidth:labelWidth+'rpx'}" v-if="label">
<text :style="{fontSize:getLabelSize,color:labelColor}">{{label}}</text> <text :style="{fontSize:getLabelSize,color:labelColor,fontWeight:500}">{{label}}</text>
</view> </view>
<slot name="left"></slot> <slot name="left"></slot>
<input class="fui-input__self" :class="{'fui-input__text-right':textRight}" <input class="fui-input__self" :class="{'fui-input__text-right':textRight}"
...@@ -618,4 +618,4 @@ ...@@ -618,4 +618,4 @@
.fui-input__text-right { .fui-input__text-right {
text-align: right; text-align: right;
} }
</style> </style>
\ No newline at end of file
<!--本文件由FirstUI授权予长沙壹润信息科技发展有限公司(手机号:1 5 616 2 6 01 95,身份证尾号:5 0 37 5T)专用,请尊重知识产权,勿私下传播,违者追究法律责任。--> <!--本文件由FirstUI授权予长沙壹润信息科技发展有限公司(手机号:1 5 616 2 6 01 95,身份证尾号:5 0 37 5T)专用,请尊重知识产权,勿私下传播,违者追究法律责任。-->
<template> <template>
<view @appear="handleAppear" class="fui-lazyload__wrap" <view @appear="handleAppear" class="fui-lazyload__wrap"
:style="{background:background,width:width+'rpx',height:height==0?'auto':height+'rpx',borderRadius:radius+'rpx'}" :style="{background:background,width:width+'rpx',borderRadius:radius+'rpx'}"
@tap="handleTap"> @tap="handleTap">
<image class="fui-lazyload__img" lazy-load :class="[visible?'fui-lazyload__visible':'fui-lazyload__hidden']" <image class="fui-lazyload__img" lazy-load :class="[visible?'fui-lazyload__visible':'fui-lazyload__hidden']"
:style="{width:width+'rpx',height:height==0?'auto':height+'rpx',borderRadius:radius+'rpx'}" :style="{width:width+'rpx',borderRadius:radius+'rpx'}"
:src="show?src:placeholder" :mode="height==0?'widthFix':mode" :webp="webp" :draggable="draggable" :src="show?src:placeholder" :mode="height==0?'widthFix':mode" :webp="webp" :draggable="draggable"
@load="handleLoad" @error="handleError" :id="elId"></image> @load="handleLoad" @error="handleError" :id="elId"></image>
<slot></slot> <slot></slot>
...@@ -194,4 +194,4 @@ ...@@ -194,4 +194,4 @@
/* #endif */ /* #endif */
opacity: 0; opacity: 0;
} }
</style> </style>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论