优化组件/更新
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<view class="uni-list-chat__container">
|
||||
<view class="uni-list-chat__header-warp">
|
||||
<view v-if="avatarCircle || avatarList.length === 0" class="uni-list-chat__header" :class="{ 'header--circle': avatarCircle }">
|
||||
<image class="uni-list-chat__header-image" :class="{ 'header--circle': avatarCircle }" :src="avatar" mode="aspectFill"></image>
|
||||
<image class="uni-list-chat__header-image" :class="{ 'header--circle': avatarCircle }" :src="avatarUrl" mode="aspectFill"></image>
|
||||
</view>
|
||||
<!-- 头像组 -->
|
||||
<view v-else class="uni-list-chat__header">
|
||||
@@ -18,6 +18,13 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- #ifndef APP -->
|
||||
<view class="slot-header">
|
||||
<!-- #endif -->
|
||||
<slot name="header"></slot>
|
||||
<!-- #ifndef APP -->
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<view v-if="badgeText && badgePositon === 'left'" class="uni-list-chat__badge uni-list-chat__badge-pos" :class="[isSingle]">
|
||||
<text class="uni-list-chat__badge-text">{{ badgeText === 'dot' ? '' : badgeText }}</text>
|
||||
</view>
|
||||
@@ -26,7 +33,7 @@
|
||||
<text class="uni-list-chat__content-title uni-ellipsis">{{ title }}</text>
|
||||
<view style="flex-direction: row;">
|
||||
<text class="draft" v-if="isDraft">[草稿]</text>
|
||||
<text class="uni-list-chat__content-note uni-ellipsis">{{isDraft?note.slice(14,-1):note}}</text>
|
||||
<text class="uni-list-chat__content-note uni-ellipsis">{{isDraft?note.slice(14):note}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="uni-list-chat__content-extra">
|
||||
@@ -152,12 +159,32 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
avatar:{
|
||||
handler(avatar) {
|
||||
if(avatar.substr(0,8) == 'cloud://'){
|
||||
uniCloud.getTempFileURL({
|
||||
fileList: [avatar]
|
||||
}).then(res=>{
|
||||
// console.log(res);
|
||||
// 兼容uniCloud私有化部署
|
||||
let fileList = res.fileList || res.result.fileList
|
||||
this.avatarUrl = fileList[0].tempFileURL
|
||||
})
|
||||
}else{
|
||||
this.avatarUrl = avatar
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isFirstChild: false,
|
||||
border: true,
|
||||
// avatarList: 3,
|
||||
imageWidth: 50
|
||||
imageWidth: 50,
|
||||
avatarUrl:''
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
@@ -204,7 +231,7 @@
|
||||
}
|
||||
},
|
||||
pageApi(api) {
|
||||
uni[api]({
|
||||
let callback = {
|
||||
url: this.to,
|
||||
success: res => {
|
||||
this.$emit('click', {
|
||||
@@ -215,9 +242,24 @@
|
||||
this.$emit('click', {
|
||||
data: err
|
||||
});
|
||||
console.error(err.errMsg);
|
||||
}
|
||||
});
|
||||
}
|
||||
switch (api) {
|
||||
case 'navigateTo':
|
||||
uni.navigateTo(callback)
|
||||
break
|
||||
case 'redirectTo':
|
||||
uni.redirectTo(callback)
|
||||
break
|
||||
case 'reLaunch':
|
||||
uni.reLaunch(callback)
|
||||
break
|
||||
case 'switchTab':
|
||||
uni.switchTab(callback)
|
||||
break
|
||||
default:
|
||||
uni.navigateTo(callback)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<!-- #ifdef APP-NVUE -->
|
||||
<cell keep-scroll-position>
|
||||
<cell :keep-scroll-position="keepScrollPosition">
|
||||
<!-- #endif -->
|
||||
<view :class="{ 'uni-list-item--disabled': disabled }" :style="{'background-color':customStyle.backgroundColor}"
|
||||
:hover-class="(!clickable && !link) || disabled || showSwitch ? '' : 'uni-list-item--hover'"
|
||||
@@ -8,14 +8,14 @@
|
||||
<view v-if="!isFirstChild" class="border--left" :class="{ 'uni-list--border': border }"></view>
|
||||
<view class="uni-list-item__container"
|
||||
:class="{ 'container--right': showArrow || link, 'flex--direction': direction === 'column'}"
|
||||
:style="{padding:customStyle.padding}">
|
||||
:style="{paddingTop:padding.top,paddingLeft:padding.left,paddingRight:padding.right,paddingBottom:padding.bottom}">
|
||||
<slot name="header">
|
||||
<view class="uni-list-item__header">
|
||||
<view v-if="thumb" class="uni-list-item__icon">
|
||||
<image :src="thumb" class="uni-list-item__icon-img" :class="['uni-list--' + thumbSize]" />
|
||||
</view>
|
||||
<view v-else-if="showExtraIcon" class="uni-list-item__icon">
|
||||
<uni-icons :color="extraIcon.color" :size="extraIcon.size" :type="extraIcon.type" />
|
||||
<uni-icons :customPrefix="extraIcon.customPrefix" :color="extraIcon.color" :size="extraIcon.size" :type="extraIcon.type" />
|
||||
</view>
|
||||
</view>
|
||||
</slot>
|
||||
@@ -37,7 +37,7 @@
|
||||
</view>
|
||||
</slot>
|
||||
</view>
|
||||
<uni-icons v-if="showArrow || link" :size="16" class="uni-icon-wrapper" color="#bbb" type="arrowright" />
|
||||
<uni-icons v-if="showArrow || link" :size="16" class="uni-icon-wrapper" color="#bbb" type="right" />
|
||||
</view>
|
||||
<!-- #ifdef APP-NVUE -->
|
||||
</cell>
|
||||
@@ -167,7 +167,8 @@
|
||||
return {
|
||||
type: '',
|
||||
color: '#000000',
|
||||
size: 20
|
||||
size: 20,
|
||||
customPrefix: ''
|
||||
};
|
||||
}
|
||||
},
|
||||
@@ -183,12 +184,66 @@
|
||||
backgroundColor: '#FFFFFF'
|
||||
}
|
||||
}
|
||||
},
|
||||
keepScrollPosition: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'customStyle.padding': {
|
||||
handler(padding) {
|
||||
if(typeof padding == 'number'){
|
||||
padding += ''
|
||||
}
|
||||
let paddingArr = padding.split(' ')
|
||||
if (paddingArr.length === 1) {
|
||||
const allPadding = paddingArr[0]
|
||||
this.padding = {
|
||||
"top": allPadding,
|
||||
"right": allPadding,
|
||||
"bottom": allPadding,
|
||||
"left": allPadding
|
||||
}
|
||||
} else if (paddingArr.length === 2) {
|
||||
const [verticalPadding, horizontalPadding] = paddingArr;
|
||||
this.padding = {
|
||||
"top": verticalPadding,
|
||||
"right": horizontalPadding,
|
||||
"bottom": verticalPadding,
|
||||
"left": horizontalPadding
|
||||
}
|
||||
} else if(paddingArr.length === 3) {
|
||||
const [topPadding, horizontalPadding, bottomPadding] = paddingArr;
|
||||
this.padding = {
|
||||
"top": topPadding,
|
||||
"right": horizontalPadding,
|
||||
"bottom": bottomPadding,
|
||||
"left": horizontalPadding
|
||||
}
|
||||
} else if (paddingArr.length === 4) {
|
||||
const [topPadding, rightPadding, bottomPadding, leftPadding] = paddingArr;
|
||||
this.padding = {
|
||||
"top": topPadding,
|
||||
"right": rightPadding,
|
||||
"bottom": bottomPadding,
|
||||
"left": leftPadding
|
||||
}
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
// inject: ['list'],
|
||||
data() {
|
||||
return {
|
||||
isFirstChild: false
|
||||
isFirstChild: false,
|
||||
padding: {
|
||||
top: "",
|
||||
right: "",
|
||||
bottom: "",
|
||||
left: ""
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
@@ -305,7 +360,7 @@
|
||||
}
|
||||
|
||||
.uni-list-item--hover {
|
||||
background-color: $uni-bg-color-hover;
|
||||
background-color: $uni-bg-color-hover !important;
|
||||
}
|
||||
|
||||
.uni-list-item__container {
|
||||
|
||||
Reference in New Issue
Block a user