feat:转账插件
This commit is contained in:
@@ -1,30 +1,30 @@
|
||||
/*
|
||||
* @Author : LQ
|
||||
* @Description :
|
||||
* @version : 1.0
|
||||
* @Date : 2021-08-20 16:44:21
|
||||
* @LastAuthor : LQ
|
||||
* @lastTime : 2021-08-20 17:01:51
|
||||
* @FilePath : /u-view2.0/uview-ui/libs/config/props/image.js
|
||||
*/
|
||||
export default {
|
||||
// image组件
|
||||
image: {
|
||||
src: '',
|
||||
mode: 'aspectFill',
|
||||
width: '300',
|
||||
height: '225',
|
||||
shape: 'square',
|
||||
radius: 0,
|
||||
lazyLoad: true,
|
||||
showMenuByLongpress: true,
|
||||
loadingIcon: 'photo',
|
||||
errorIcon: 'error-circle',
|
||||
showLoading: true,
|
||||
showError: true,
|
||||
fade: true,
|
||||
webp: false,
|
||||
duration: 500,
|
||||
bgColor: '#f3f4f6'
|
||||
}
|
||||
}
|
||||
/*
|
||||
* @Author : LQ
|
||||
* @Description :
|
||||
* @version : 3.0
|
||||
* @Date : 2021-08-20 16:44:21
|
||||
* @LastAuthor : jry
|
||||
* @lastTime : 2025-12-19 08:55:21
|
||||
* @FilePath : /uview-plus/libs/config/props/image.js
|
||||
*/
|
||||
export default {
|
||||
// image组件
|
||||
image: {
|
||||
src: '',
|
||||
mode: 'aspectFill',
|
||||
width: '300',
|
||||
height: '225',
|
||||
shape: 'square',
|
||||
radius: 0,
|
||||
lazyLoad: true,
|
||||
showMenuByLongpress: true,
|
||||
loadingIcon: 'photo',
|
||||
errorIcon: 'error-circle',
|
||||
showLoading: true,
|
||||
showError: true,
|
||||
fade: true,
|
||||
webp: false,
|
||||
duration: 500,
|
||||
bgColor: '#f3f4f6'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { defineMixin } from '../../libs/vue'
|
||||
import defProps from '../../libs/config/props.js'
|
||||
import ImageDefaultProps from './image'
|
||||
import { registerComponentProps } from '../../libs/config/props.js'
|
||||
|
||||
const defProps = registerComponentProps(ImageDefaultProps)
|
||||
export const props = defineMixin({
|
||||
props: {
|
||||
// 图片地址
|
||||
|
||||
@@ -36,22 +36,25 @@
|
||||
}"
|
||||
>
|
||||
<slot name="loading">
|
||||
<u-icon
|
||||
<up-icon
|
||||
:name="loadingIcon"
|
||||
></u-icon>
|
||||
></up-icon>
|
||||
</slot>
|
||||
</view>
|
||||
<view
|
||||
v-if="showError && isError && !loading"
|
||||
class="u-image__error"
|
||||
:style="{
|
||||
borderRadius: shape == 'circle' ? '50%' : addUnit(radius)
|
||||
borderRadius: shape == 'circle' ? '50%' : addUnit(radius),
|
||||
backgroundColor: this.bgColor,
|
||||
width: addUnit(width),
|
||||
height: addUnit(height)
|
||||
}"
|
||||
>
|
||||
<slot name="error">
|
||||
<u-icon
|
||||
<up-icon
|
||||
:name="errorIcon"
|
||||
></u-icon>
|
||||
></up-icon>
|
||||
</slot>
|
||||
</view>
|
||||
</view>
|
||||
@@ -123,50 +126,59 @@
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
transStyle() {
|
||||
let style = {};
|
||||
// 通过调用addUnit()方法,如果有单位,如百分比,px单位等,直接返回,如果是纯粹的数值,则加上rpx单位
|
||||
resolvedSizeStyle() {
|
||||
const style = {};
|
||||
// #ifdef APP-NVUE
|
||||
style.width = addUnit(this.width);
|
||||
style.height = addUnit(this.height);
|
||||
// #endif
|
||||
// #ifndef APP-NVUE
|
||||
// widthFix/heightFix 加载完成后用 fit-content 跟随图片比例;其余模式固定宽高
|
||||
if (this.loading || this.isError || this.width == '100%' || this.mode != 'heightFix') {
|
||||
style.width = this.width;
|
||||
style.width = addUnit(this.width);
|
||||
} else {
|
||||
style.width = 'fit-content';
|
||||
}
|
||||
if (this.loading || this.isError || this.height == '100%' || this.mode != 'widthFix') {
|
||||
style.height = this.height;
|
||||
style.height = addUnit(this.height);
|
||||
} else {
|
||||
style.height = 'fit-content';
|
||||
}
|
||||
// #endif
|
||||
return style;
|
||||
},
|
||||
transStyle() {
|
||||
return {
|
||||
...this.resolvedSizeStyle,
|
||||
// flex 行布局下默认 shrink=1 会把固定宽图片压成细条
|
||||
flexShrink: 0,
|
||||
boxSizing: 'border-box',
|
||||
maxWidth: '100%'
|
||||
};
|
||||
},
|
||||
wrapStyle() {
|
||||
let style = {};
|
||||
// 通过调用addUnit()方法,如果有单位,如百分比,px单位等,直接返回,如果是纯粹的数值,则加上rpx单位
|
||||
// #ifdef APP-NVUE
|
||||
style.width = addUnit(this.width);
|
||||
style.height = addUnit(this.height);
|
||||
// #endif
|
||||
// #ifndef APP-NVUE
|
||||
if (this.loading || this.isError || this.width == '100%' || this.mode != 'heightFix') {
|
||||
style.width = this.width;
|
||||
} else {
|
||||
style.width = 'fit-content';
|
||||
let style = {
|
||||
...this.resolvedSizeStyle,
|
||||
flexShrink: 0,
|
||||
boxSizing: 'border-box',
|
||||
maxWidth: '100%'
|
||||
};
|
||||
// 固定尺寸时用 minWidth/minHeight 抵抗 flex 压缩;百分比宽度不设 minWidth 以免撑破父级
|
||||
const widthText = String(style.width || '')
|
||||
const heightText = String(style.height || '')
|
||||
if (widthText && widthText !== 'fit-content' && !widthText.includes('%')) {
|
||||
style.minWidth = widthText
|
||||
}
|
||||
if (this.loading || this.isError || this.height == '100%' || this.mode != 'widthFix') {
|
||||
style.height = this.height;
|
||||
} else {
|
||||
style.height = 'fit-content';
|
||||
if (heightText && heightText !== 'fit-content' && !heightText.includes('%')) {
|
||||
style.minHeight = heightText
|
||||
}
|
||||
// #endif
|
||||
// 如果是显示圆形,设置一个很多的半径值即可
|
||||
style.borderRadius = this.shape == 'circle' ? '10000px' : addUnit(this.radius)
|
||||
// 如果设置圆角,必须要有hidden,否则可能圆角无效
|
||||
style.overflow = this.radius > 0 ? 'hidden' : 'visible'
|
||||
// radius 可能是 "12px" 字符串,不能用 > 0 判断
|
||||
const radiusNumber = Number(String(this.radius ?? '').replace(/[^\d.-]/g, ''))
|
||||
const hasRadius = this.shape == 'circle' || (!Number.isNaN(radiusNumber) && radiusNumber > 0)
|
||||
// 裁剪圆角 / aspectFill 时需要 hidden,避免内容溢出成细条错位
|
||||
style.overflow = hasRadius || this.mode === 'aspectFill' || this.mode === 'aspectFit' ? 'hidden' : 'visible'
|
||||
// if (this.fade) {
|
||||
// style.opacity = this.opacity
|
||||
// // nvue下,这几个属性必须要分开写
|
||||
@@ -220,17 +232,15 @@
|
||||
// 移除图片的背景色
|
||||
removeBgColor() {
|
||||
// 淡入动画过渡完成后,将背景设置为透明色,否则png图片会看到灰色的背景
|
||||
this.backgroundStyle = {
|
||||
backgroundColor: this.bgColor || '#ffffff'
|
||||
};
|
||||
// this.backgroundStyle = {
|
||||
// backgroundColor: this.bgColor || '#ffffff'
|
||||
// };
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '../../libs/css/components.scss';
|
||||
|
||||
$u-image-error-top:0px !default;
|
||||
$u-image-error-left:0px !default;
|
||||
$u-image-error-width:100% !default;
|
||||
@@ -242,10 +252,14 @@
|
||||
.u-image {
|
||||
position: relative;
|
||||
transition: opacity 0.5s ease-in-out;
|
||||
flex-shrink: 0;
|
||||
max-width: 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
&__image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
&__loading,
|
||||
|
||||
Reference in New Issue
Block a user