Merge remote-tracking branch 'origin/feature/1.8.0-uniapp' into feature/1.8.0-uniapp
commit
8f6c37755c
|
@ -0,0 +1,58 @@
|
|||
<template>
|
||||
<u-swiper :list="bannerList" :keyName="keyName" previousMargin="20" nextMargin="20" circular height="150" @change="e => (current = e.current)" :autoplay="true" @click="handleSwiperClick">
|
||||
<view slot="indicator" class="indicator">
|
||||
<view class="indicator__dot" v-for="(item, index) in bannerList" :key="index" :class="[index === current && 'indicator__dot--active']"></view>
|
||||
</view>
|
||||
</u-swiper>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* 广告滚动图
|
||||
*/
|
||||
export default {
|
||||
name: 'mkt-banner',
|
||||
components: {},
|
||||
props: {
|
||||
keyName: {
|
||||
type: String,
|
||||
default: 'url'
|
||||
},
|
||||
bannerList: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
current: 0,
|
||||
currentNum: 0
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleSwiperClick(index) {
|
||||
console.log('点击了图片索引值:', index)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.indicator {
|
||||
@include flex(row);
|
||||
justify-content: center;
|
||||
|
||||
&__dot {
|
||||
height: 15rpx;
|
||||
width: 15rpx;
|
||||
border-radius: 100rpx;
|
||||
background-color: rgba(255, 255, 255, 0.35);
|
||||
margin: 0 10rpx;
|
||||
transition: background-color 0.3s;
|
||||
|
||||
&--active {
|
||||
background-color: $custom-bg-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,173 @@
|
|||
<template>
|
||||
<view>
|
||||
<view v-if="showType === 'normal'">
|
||||
<u-gap height="180" bgColor="#398ade"></u-gap>
|
||||
<view class="prod-block">
|
||||
<view class="bloc-header">
|
||||
<text class="bloc-title">{{title}}</text>
|
||||
<text class="see-more">查看更多</text>
|
||||
</view>
|
||||
<view class="prod-grid">
|
||||
<view class="prod-item" v-for="(item, index) in productList" :key="item.id" @click="handleProdItemClick(item.id)">
|
||||
<image class="prod-image" :src="item.image"></image>
|
||||
<view class="item-info">
|
||||
<view class="info-text">
|
||||
<u--text :lines="2" size="14px" color="#333333" :text="item.title"></u--text>
|
||||
</view>
|
||||
<view class="price-and-cart">
|
||||
<yd-text-price color="red" size="12" intSize="18" :price="item.price"></yd-text-price>
|
||||
<u-icon name="shopping-cart" color="#2979ff" size="28"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="showType === 'half'">
|
||||
<view class="prod-block half">
|
||||
<view class="bloc-header">
|
||||
<text class="bloc-title">{{title}}</text>
|
||||
<text class="more">更多 ></text>
|
||||
</view>
|
||||
<view class="prod-grid half">
|
||||
<view class="prod-item" v-for="(item, index) in productList" :key="item.id" @click="handleProdItemClick(item.id)">
|
||||
<image class="prod-image" :src="item.image"></image>
|
||||
<view class="item-info">
|
||||
<view class="info-text">
|
||||
<u--text :lines="1" size="14px" color="#333333" :text="item.title"></u--text>
|
||||
<u--text :lines="1" size="12px" color="#939393" :text="item.desc"></u--text>
|
||||
</view>
|
||||
<view class="price-and-cart">
|
||||
<yd-text-price color="red" size="12" intSize="18" :price="item.price"></yd-text-price>
|
||||
<u-icon name="shopping-cart" color="#2979ff" size="28"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
export default {
|
||||
name: 'yd-product-box',
|
||||
components: {},
|
||||
props: {
|
||||
showType: {
|
||||
type: String,
|
||||
default: 'normal'
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: '商品推荐'
|
||||
},
|
||||
productList: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
handleProdItemClick(productId) {
|
||||
uni.$u.route('/pages/product/product', {
|
||||
productId: productId
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.prod-block {
|
||||
margin-top: -160px;
|
||||
|
||||
.bloc-header {
|
||||
@include flex-space-between;
|
||||
padding: 10rpx 20rpx;
|
||||
|
||||
.bloc-title {
|
||||
color: $custom-bg-color;
|
||||
font-size: 34rpx;
|
||||
}
|
||||
|
||||
.see-more {
|
||||
color: $custom-bg-color;
|
||||
background: $u-primary;
|
||||
padding: 0 30rpx;
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
border-radius: 50rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
&.half {
|
||||
margin-top: 0;
|
||||
|
||||
.bloc-header {
|
||||
margin-top: 50rpx;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.bloc-title {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.more {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.prod-grid {
|
||||
width: 730rpx;
|
||||
margin: 0 auto;
|
||||
@include flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: left;
|
||||
|
||||
&.half {
|
||||
.prod-item {
|
||||
width: 345rpx;
|
||||
margin: 10rpx;
|
||||
|
||||
.prod-image {
|
||||
width: 345rpx;
|
||||
height: 345rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.prod-item {
|
||||
width: 223rpx;
|
||||
margin: 10rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 10rpx;
|
||||
box-shadow: 0rpx 6rpx 8rpx rgba(58, 134, 185, 0.2);
|
||||
|
||||
.prod-image {
|
||||
width: 223rpx;
|
||||
height: 223rpx;
|
||||
border-radius: 10rpx 10rpx 0 0;
|
||||
}
|
||||
|
||||
.item-info {
|
||||
padding: 15rpx;
|
||||
|
||||
.info-text {
|
||||
height: 70rpx;
|
||||
padding-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.price-and-cart {
|
||||
@include flex-space-between;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,114 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="prod-block list">
|
||||
<view class="bloc-header">
|
||||
<text class="bloc-title">更多宝贝</text>
|
||||
<text></text>
|
||||
</view>
|
||||
|
||||
<view class="prod-list" v-for="(item, index) in productList" :key="item.id">
|
||||
<view class="prod-item" @click="handleProdItemClick(item.id)">
|
||||
<image class="prod-image" :src="item.image"></image>
|
||||
<view class="item-info">
|
||||
<view class="info-text">
|
||||
<u--text :lines="1" size="14px" color="#333333" :text="item.title"></u--text>
|
||||
<u-gap height="2px"></u-gap>
|
||||
<u--text class="info-desc" :lines="2" size="12px" color="#939393" :text="item.desc"></u--text>
|
||||
</view>
|
||||
<view class="price-and-cart">
|
||||
<yd-text-price color="red" size="12" intSize="18" :price="item.price"></yd-text-price>
|
||||
<u-icon name="shopping-cart" color="#2979ff" size="28"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!--加载更多-->
|
||||
<u-loadmore fontSize="28rpx" :line="true" :status="moreStatus" :loading-text="loadingText" :loadmore-text="loadmoreText" :nomore-text="nomoreText" />
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
export default {
|
||||
name: 'yd-product-more',
|
||||
components: {},
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: '商品推荐'
|
||||
},
|
||||
productList: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
moreStatus: {
|
||||
type: String,
|
||||
default: 'nomore'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
//status: 'nomore',
|
||||
loadingText: '加载中...',
|
||||
loadmoreText: '上拉加载更多',
|
||||
nomoreText: '已经到底了'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleProdItemClick(productId) {
|
||||
uni.$u.route('/pages/product/product', {
|
||||
productId: productId
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.prod-block {
|
||||
margin-top: 0;
|
||||
|
||||
.bloc-header {
|
||||
margin-top: 50rpx;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.bloc-title {
|
||||
margin-left: 20rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
.prod-list {
|
||||
.prod-item {
|
||||
background: #ffffff;
|
||||
@include flex-space-between;
|
||||
border-bottom: $custom-border-style;
|
||||
padding: 20rpx;
|
||||
|
||||
.prod-image {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.item-info {
|
||||
flex: 1;
|
||||
padding: 20rpx 20rpx 0;
|
||||
|
||||
.info-text {
|
||||
height: 100rpx;
|
||||
padding-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.price-and-cart {
|
||||
@include flex-space-between;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -11,7 +11,7 @@
|
|||
* 此组件简单的显示特定样式的(人名币)价格数字
|
||||
*/
|
||||
export default {
|
||||
name: 'custom-text-price',
|
||||
name: 'yd-text-price',
|
||||
components: {},
|
||||
props: {
|
||||
price: {
|
|
@ -8,17 +8,13 @@
|
|||
</u-sticky>
|
||||
|
||||
<!--轮播图-->
|
||||
<u-swiper :list="swiperList" previousMargin="20" nextMargin="20" circular height="200" @change="e => (current = e.current)" :autoplay="true" @click="handleSwiperClick">
|
||||
<view slot="indicator" class="indicator">
|
||||
<view class="indicator__dot" v-for="(item, index) in swiperList" :key="index" :class="[index === current && 'indicator__dot--active']"> </view>
|
||||
</view>
|
||||
</u-swiper>
|
||||
<mkt-banner :banner-list="bannerList"></mkt-banner>
|
||||
|
||||
<u-gap height="20px"></u-gap>
|
||||
|
||||
<!--宫格菜单按钮-->
|
||||
<u-grid :border="false" col="4"
|
||||
><u-grid-item v-for="(item, index) in menuList" :key="index">
|
||||
<u-grid :border="false" col="4">
|
||||
<u-grid-item v-for="(item, index) in menuList" :key="index">
|
||||
<u-icon :name="item.icon" :size="40"></u-icon>
|
||||
<text class="grid-title">{{ item.title }}</text>
|
||||
</u-grid-item>
|
||||
|
@ -30,81 +26,11 @@
|
|||
<u-notice-bar style="padding: 13px 12px" :text="noticeList" mode="link" direction="column" @click="click"></u-notice-bar>
|
||||
|
||||
<!--商品展示栏-->
|
||||
<view>
|
||||
<u-gap height="180" bgColor="#398ade"></u-gap>
|
||||
<view class="prod-block">
|
||||
<view class="bloc-header">
|
||||
<text class="bloc-title">每日上新</text>
|
||||
<text class="see-more">查看更多</text>
|
||||
</view>
|
||||
<view class="prod-grid">
|
||||
<view class="prod-item" v-for="(item, index) in productList" :key="item.id" @click="handleProdItemClick(item.id)">
|
||||
<image class="prod-image" :src="item.image"></image>
|
||||
<view class="item-info">
|
||||
<view class="info-text">
|
||||
<u--text :lines="2" size="14px" color="#333333" :text="item.title"></u--text>
|
||||
</view>
|
||||
<view class="price-and-cart">
|
||||
<custom-text-price color="red" size="12" intSize="18" :price="item.price"></custom-text-price>
|
||||
<u-icon name="shopping-cart" color="#2979ff" size="28"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<yd-product-box :product-list="productList" :title="'每日上新'" show-type="normal"></yd-product-box>
|
||||
<yd-product-box :product-list="productList" :title="'热卖商品'" show-type="half"></yd-product-box>
|
||||
<yd-product-more :product-list="productList" more-status="moreStatus"></yd-product-more>
|
||||
|
||||
<view>
|
||||
<view class="prod-block half">
|
||||
<view class="bloc-header">
|
||||
<text class="bloc-title">商品热卖</text>
|
||||
<text class="more">更多 ></text>
|
||||
</view>
|
||||
<view class="prod-grid half">
|
||||
<view class="prod-item" v-for="(item, index) in productList" :key="item.id" @click="handleProdItemClick(item.id)">
|
||||
<image class="prod-image" :src="item.image"></image>
|
||||
<view class="item-info">
|
||||
<view class="info-text">
|
||||
<u--text :lines="1" size="14px" color="#333333" :text="item.title"></u--text>
|
||||
<u--text :lines="1" size="12px" color="#939393" :text="item.desc"></u--text>
|
||||
</view>
|
||||
<view class="price-and-cart">
|
||||
<custom-text-price color="red" size="12" intSize="18" :price="item.price"></custom-text-price>
|
||||
<u-icon name="shopping-cart" color="#2979ff" size="28"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<view class="prod-block list">
|
||||
<view class="bloc-header">
|
||||
<text class="bloc-title">更多宝贝</text>
|
||||
<text></text>
|
||||
</view>
|
||||
|
||||
<view class="prod-list" v-for="(item, index) in productList" :key="item.id">
|
||||
<view class="prod-item" @click="handleProdItemClick(item.id)">
|
||||
<image class="prod-image" :src="item.image"></image>
|
||||
<view class="item-info">
|
||||
<view class="info-text">
|
||||
<u--text :lines="1" size="14px" color="#333333" :text="item.title"></u--text>
|
||||
<u-gap height="2px"></u-gap>
|
||||
<u--text class="info-desc" :lines="2" size="12px" color="#939393" :text="item.desc"></u--text>
|
||||
</view>
|
||||
<view class="price-and-cart">
|
||||
<custom-text-price color="red" size="12" intSize="18" :price="item.price"></custom-text-price>
|
||||
<u-icon name="shopping-cart" color="#2979ff" size="28"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!--加载更多-->
|
||||
<u-loadmore fontSize="28rpx" :status="status" :loading-text="loadingText" :loadmore-text="loadmoreText" :nomore-text="nomoreText" />
|
||||
<u-gap height="5px"></u-gap>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -115,9 +41,23 @@ export default {
|
|||
components: {},
|
||||
data() {
|
||||
return {
|
||||
current: 0,
|
||||
currentNum: 0,
|
||||
bannerList: ['https://cdn.uviewui.com/uview/swiper/swiper3.png', 'https://cdn.uviewui.com/uview/swiper/swiper2.png', 'https://cdn.uviewui.com/uview/swiper/swiper1.png'],
|
||||
bannerList: [
|
||||
{
|
||||
id: 1,
|
||||
title: '山不在高,有仙则名',
|
||||
url: 'https://cdn.uviewui.com/uview/swiper/swiper1.png'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: '水不在深,有龙则灵',
|
||||
url: 'https://cdn.uviewui.com/uview/swiper/swiper2.png'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: '斯是陋室,惟吾德馨',
|
||||
url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png'
|
||||
}
|
||||
],
|
||||
menuList: [
|
||||
{ icon: 'gift', title: '热门推荐' },
|
||||
{ icon: 'star', title: '收藏转发' },
|
||||
|
@ -162,15 +102,12 @@ export default {
|
|||
price: '53.00'
|
||||
}
|
||||
],
|
||||
status: 'nomore',
|
||||
loadingText: '努力加载中...',
|
||||
loadmoreText: '轻轻上拉',
|
||||
nomoreText: '实在没有了...'
|
||||
moreStatus: 'nomore'
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.loadBannerData();
|
||||
this.loadNoticeData();
|
||||
this.loadBannerData()
|
||||
this.loadNoticeData()
|
||||
},
|
||||
methods: {
|
||||
loadBannerData() {
|
||||
|
@ -185,24 +122,9 @@ export default {
|
|||
},
|
||||
handleSearchClick(e) {
|
||||
uni.$u.route('/pages/search/search')
|
||||
},
|
||||
handleSwiperClick(index) {
|
||||
console.log('点击了图片索引值:', index)
|
||||
},
|
||||
handleProdItemClick(productId) {
|
||||
uni.$u.route('/pages/product/product', {
|
||||
productId: productId
|
||||
})
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
swiperList() {
|
||||
return this.bannerList.map(item => {
|
||||
if (item) {
|
||||
return item
|
||||
}
|
||||
})
|
||||
},
|
||||
noticeTextList() {
|
||||
return this.noticeList.map(item => {
|
||||
if (item.title) {
|
||||
|
@ -220,131 +142,8 @@ export default {
|
|||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.indicator {
|
||||
@include flex(row);
|
||||
justify-content: center;
|
||||
|
||||
&__dot {
|
||||
height: 15rpx;
|
||||
width: 15rpx;
|
||||
border-radius: 100rpx;
|
||||
background-color: rgba(255, 255, 255, 0.35);
|
||||
margin: 0 10rpx;
|
||||
transition: background-color 0.3s;
|
||||
|
||||
&--active {
|
||||
background-color: $custom-bg-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.grid-title {
|
||||
line-height: 50rpx;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.prod-block {
|
||||
margin-top: -160px;
|
||||
.bloc-header {
|
||||
@include flex-space-between;
|
||||
padding: 10rpx 20rpx;
|
||||
|
||||
.bloc-title {
|
||||
color: $custom-bg-color;
|
||||
font-size: 34rpx;
|
||||
}
|
||||
.see-more {
|
||||
color: $custom-bg-color;
|
||||
background: $u-primary;
|
||||
padding: 0 30rpx;
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
border-radius: 50rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
&.half,
|
||||
&.list {
|
||||
margin-top: 0;
|
||||
.bloc-header {
|
||||
margin-top: 50rpx;
|
||||
margin-bottom: 20rpx;
|
||||
.bloc-title {
|
||||
color: #333333;
|
||||
}
|
||||
.more {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.prod-grid {
|
||||
width: 730rpx;
|
||||
margin: 0 auto;
|
||||
@include flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: left;
|
||||
|
||||
&.half {
|
||||
.prod-item {
|
||||
width: 345rpx;
|
||||
margin: 10rpx;
|
||||
.prod-image {
|
||||
width: 345rpx;
|
||||
height: 345rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.prod-item {
|
||||
width: 223rpx;
|
||||
margin: 10rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 10rpx;
|
||||
box-shadow: 0rpx 6rpx 8rpx rgba(58,134,185,0.2);
|
||||
.prod-image {
|
||||
width: 223rpx;
|
||||
height: 223rpx;
|
||||
border-radius: 10rpx 10rpx 0 0;
|
||||
}
|
||||
.item-info {
|
||||
padding: 15rpx;
|
||||
.info-text {
|
||||
height: 70rpx;
|
||||
padding-bottom: 10rpx;
|
||||
}
|
||||
.price-and-cart {
|
||||
@include flex-space-between;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.prod-list {
|
||||
.prod-item {
|
||||
background: #ffffff;
|
||||
@include flex-space-between;
|
||||
border-bottom: $custom-border-style;
|
||||
padding: 20rpx;
|
||||
.prod-image {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.item-info {
|
||||
flex: 1;
|
||||
padding: 20rpx 20rpx 0;
|
||||
.info-text {
|
||||
height: 100rpx;
|
||||
padding-bottom: 10rpx;
|
||||
}
|
||||
.price-and-cart {
|
||||
@include flex-space-between;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -10,43 +10,22 @@
|
|||
</view>
|
||||
<view class="info-item">
|
||||
<view class="label">昵称:</view>
|
||||
<view v-if="!nameEditOn" class="info">
|
||||
<view class="value">{{ userInfo.nickname }}</view>
|
||||
<u-icon
|
||||
class="btn"
|
||||
name="edit-pen"
|
||||
@click="
|
||||
tempName = userInfo.nickname
|
||||
nameEditOn = true
|
||||
"
|
||||
></u-icon>
|
||||
</view>
|
||||
<view v-else class="name-edit">
|
||||
<u--input maxlength="10" border="bottom" v-model="tempName"></u--input>
|
||||
<view class="edit-btn-group">
|
||||
<u-tag class="edit-btn" text="保存" plain size="mini" type="primary" @click="handleSaveBtnClick"></u-tag>
|
||||
<u-tag
|
||||
class="edit-btn"
|
||||
text="取消"
|
||||
plain
|
||||
size="mini"
|
||||
type="info"
|
||||
@click="
|
||||
tempName = ''
|
||||
nameEditOn = false
|
||||
"
|
||||
></u-tag>
|
||||
</view>
|
||||
<view class="info">
|
||||
<u--input maxlength="10" :border="borderStyle" v-model="userInfo.nickname" @focus="borderStyle = 'bottom'" inputAlign="right" @blur="borderStyle = 'none'" @change="handleNameChange"></u--input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="label">手机:</view>
|
||||
<view class="info">
|
||||
<view class="value">{{ userInfo.mobile }}</view>
|
||||
<u-icon class="btn" name="edit-pen"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="nameUpdateVisible" class="btn-group">
|
||||
<u-button type="primary" text="保存" customStyle="margin-top: 50px" @click="handleSaveBtnClick"></u-button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -62,8 +41,13 @@ export default {
|
|||
mobile: ''
|
||||
},
|
||||
avatarFiles: [],
|
||||
nameEditOn: false,
|
||||
tempName: ''
|
||||
tempName: '',
|
||||
borderStyle: 'none'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
nameUpdateVisible: function () {
|
||||
return this.userInfo.nickname !== this.tempName
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
|
@ -73,6 +57,7 @@ export default {
|
|||
loadUserInfoData() {
|
||||
getUserInfo().then(res => {
|
||||
this.userInfo = res.data
|
||||
this.tempName = this.userInfo.nickname
|
||||
})
|
||||
},
|
||||
handleAvatarClick() {
|
||||
|
@ -86,11 +71,22 @@ export default {
|
|||
}
|
||||
})
|
||||
},
|
||||
handleNameChange(val) {
|
||||
let str = uni.$u.trim(val, 'all')
|
||||
this.$nextTick(() => {
|
||||
this.userInfo.nickname = str
|
||||
})
|
||||
},
|
||||
handleSaveBtnClick() {
|
||||
updateNickname({ nickname: this.tempName }).then(res => {
|
||||
this.nameEditOn = false;
|
||||
this.userInfo.nickname = this.tempName
|
||||
updateNickname({ nickname: this.userInfo.nickname }).then(res => {
|
||||
this.tempName = this.userInfo.nickname
|
||||
this.$store.commit('SET_USER_INFO', this.userInfo)
|
||||
uni.$u.toast('已保存')
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
url: '/pages/user/user'
|
||||
})
|
||||
}, 300)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +103,7 @@ export default {
|
|||
font-size: 30rpx;
|
||||
}
|
||||
.info {
|
||||
@include flex-right;
|
||||
@include flex-left;
|
||||
.value {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
@ -126,4 +122,8 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn-group {
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,73 +1,56 @@
|
|||
<p align="center">
|
||||
<img alt="logo" src="https://uviewui.com/common/logo.png" width="120" height="120" style="margin-bottom: 10px;">
|
||||
</p>
|
||||
<h3 align="center" style="margin: 30px 0 30px;font-weight: bold;font-size:40px;">uView</h3>
|
||||
<h3 align="center" style="margin: 30px 0 30px;font-weight: bold;font-size:40px;">uView 2.0</h3>
|
||||
<h3 align="center">多平台快速开发的UI框架</h3>
|
||||
|
||||
[![stars](https://img.shields.io/github/stars/umicro/uView2.0?style=flat-square&logo=GitHub)](https://github.com/umicro/uView2.0)
|
||||
[![forks](https://img.shields.io/github/forks/umicro/uView2.0?style=flat-square&logo=GitHub)](https://github.com/umicro/uView2.0)
|
||||
[![issues](https://img.shields.io/github/issues/umicro/uView2.0?style=flat-square&logo=GitHub)](https://github.com/umicro/uView2.0/issues)
|
||||
[![Website](https://img.shields.io/badge/uView-up-blue?style=flat-square)](https://uviewui.com)
|
||||
[![release](https://img.shields.io/github/v/release/umicro/uView2.0?style=flat-square)](https://gitee.com/umicro/uView2.0/releases)
|
||||
[![license](https://img.shields.io/github/license/umicro/uView2.0?style=flat-square)](https://en.wikipedia.org/wiki/MIT_License)
|
||||
|
||||
## 说明
|
||||
|
||||
uView UI,是[uni-app](https://uniapp.dcloud.io/)生态优秀的UI框架,全面的组件和便捷的工具会让您信手拈来,如鱼得水
|
||||
uView UI,是[uni-app](https://uniapp.dcloud.io/)全面兼容nvue的uni-app生态框架,全面的组件和便捷的工具会让您信手拈来,如鱼得水
|
||||
|
||||
## 特性
|
||||
## [官方文档:https://uviewui.com](https://uviewui.com)
|
||||
|
||||
- 兼容安卓,iOS,微信小程序,H5,QQ小程序,百度小程序,支付宝小程序,头条小程序
|
||||
- 60+精选组件,功能丰富,多端兼容,让您快速集成,开箱即用
|
||||
- 众多贴心的JS利器,让您飞镖在手,召之即来,百步穿杨
|
||||
- 众多的常用页面和布局,让您专注逻辑,事半功倍
|
||||
- 详尽的文档支持,现代化的演示效果
|
||||
- 按需引入,精简打包体积
|
||||
|
||||
## 预览
|
||||
|
||||
您可以通过**微信**扫码,查看最佳的演示效果。
|
||||
<br>
|
||||
<br>
|
||||
<img src="https://uviewui.com/common/weixin_mini_qrcode.png" width="220" height="220" >
|
||||
|
||||
|
||||
## 链接
|
||||
|
||||
- [官方文档](https://www.uviewui.com/)
|
||||
- [更新日志](https://www.uviewui.com/components/changelog.html)
|
||||
- [升级指南](https://www.uviewui.com/components/changeGuide.html)
|
||||
- [关于我们](https://www.uviewui.com/cooperation/about.html)
|
||||
|
||||
## 交流反馈
|
||||
|
||||
欢迎加入我们的QQ群交流反馈:[点此跳转](https://www.uviewui.com/components/addQQGroup.html)
|
||||
|
||||
## 关于PR
|
||||
|
||||
> 我们非常乐意接受各位的优质PR,但在此之前我希望您了解uView2.0是一个需要兼容多个平台的(小程序、h5、ios app、android app)包括nvue页面、vue页面。
|
||||
> 所以希望在您修复bug并提交之前尽可能的去这些平台测试一下兼容性。最好能携带测试截图以方便审核。非常感谢!
|
||||
|
||||
## 安装
|
||||
|
||||
```bash
|
||||
# npm方式安装,插件市场导入无需执行此命令
|
||||
npm i uview-ui
|
||||
```
|
||||
#### **uni-app插件市场链接** —— [https://ext.dcloud.net.cn/plugin?id=1593](https://ext.dcloud.net.cn/plugin?id=1593)
|
||||
|
||||
请通过[官网安装文档](https://www.uviewui.com/components/install.html)了解更详细的内容
|
||||
|
||||
## 快速上手
|
||||
|
||||
1. `main.js`引入uView库
|
||||
```js
|
||||
// main.js
|
||||
import uView from 'uview-ui';
|
||||
Vue.use(uView);
|
||||
```
|
||||
|
||||
2. `App.vue`引入基础样式(注意style标签需声明scss属性支持)
|
||||
```css
|
||||
/* App.vue */
|
||||
<style lang="scss">
|
||||
@import "uview-ui/index.scss";
|
||||
</style>
|
||||
```
|
||||
|
||||
3. `uni.scss`引入全局scss变量文件
|
||||
```css
|
||||
/* uni.scss */
|
||||
@import "uview-ui/theme.scss";
|
||||
```
|
||||
|
||||
4. `pages.json`配置easycom规则(按需引入)
|
||||
|
||||
```js
|
||||
// pages.json
|
||||
{
|
||||
"easycom": {
|
||||
// npm安装的方式不需要前面的"@/",下载安装的方式需要"@/"
|
||||
// npm安装方式
|
||||
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
|
||||
// 下载安装方式
|
||||
// "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
|
||||
},
|
||||
// 此为本身已有的内容
|
||||
"pages": [
|
||||
// ......
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
请通过[快速上手](https://www.uviewui.com/components/quickstart.html)了解更详细的内容
|
||||
请通过[快速上手](https://uviewui.com/components/quickstart.html)了解更详细的内容
|
||||
|
||||
## 使用方法
|
||||
配置easycom规则后,自动按需引入,无需`import`组件,直接引用即可。
|
||||
|
@ -78,27 +61,6 @@ Vue.use(uView);
|
|||
</template>
|
||||
```
|
||||
|
||||
请通过[快速上手](https://www.uviewui.com/components/quickstart.html)了解更详细的内容
|
||||
|
||||
## 链接
|
||||
|
||||
- [官方文档](https://www.uviewui.com/)
|
||||
- [更新日志](https://www.www.uviewui.com/components/changelog.html)
|
||||
- [升级指南](https://www.uviewui.com/components/changelog.html)
|
||||
- [关于我们](https://www.uviewui.com/cooperation/about.html)
|
||||
|
||||
## 预览
|
||||
|
||||
您可以通过**微信**扫码,查看最佳的演示效果。
|
||||
<br>
|
||||
<br>
|
||||
<img src="https://uviewui.com/common/weixin_mini_qrcode.png" width="220" height="220" >
|
||||
|
||||
## 捐赠uView的研发
|
||||
|
||||
uView文档和源码全部开源免费,如果您认为uView帮到了您的开发工作,您可以捐赠uView的研发工作,捐赠无门槛,哪怕是一杯可乐也好(相信这比打赏主播更有意义)。
|
||||
|
||||
<img src="https://uviewui.com/common/alipay.png" width="220" ><img style="margin-left: 100px;" src="https://uviewui.com/common/wechat.png" width="220" >
|
||||
|
||||
## 版权信息
|
||||
uView遵循[MIT](https://en.wikipedia.org/wiki/MIT_License)开源协议,意味着您无需支付任何费用,也无需授权,即可将uView应用到您的产品中。
|
||||
|
||||
|
|
|
@ -1,3 +1,42 @@
|
|||
## 2.0.34(2022-09-25)
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖
|
||||
|
||||
1. `u-input`、`u-textarea`增加`ignoreCompositionEvent`属性
|
||||
2. 修复`route`方法调用可能报错的问题
|
||||
3. 修复`u-no-network`组件`z-index`无效的问题
|
||||
4. 修复`textarea`组件在h5上confirmType=""报错的问题
|
||||
5. `u-rate`适配`nvue`
|
||||
6. 优化验证手机号码的正则表达式(根据工信部发布的《电信网编号计划(2017年版)》进行修改。)
|
||||
7. `form-item`添加`labelPosition`属性
|
||||
8. `u-calendar`修复`maxDate`设置为当前日期,并且当前时间大于08:00时无法显示日期列表的问题 (#724)
|
||||
9. `u-radio`增加一个默认插槽用于自定义修改label内容 (#680)
|
||||
10. 修复`timeFormat`函数在safari重的兼容性问题 (#664)
|
||||
## 2.0.33(2022-06-17)
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖
|
||||
|
||||
1. 修复`loadmore`组件`lineColor`类型错误问题
|
||||
2. 修复`u-parse`组件`imgtap`、`linktap`不生效问题
|
||||
## 2.0.32(2022-06-16)
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖
|
||||
1. `u-loadmore`新增自定义颜色、虚/实线
|
||||
2. 修复`u-swiper-action`组件部分平台不能上下滑动的问题
|
||||
3. 修复`u-list`回弹问题
|
||||
4. 修复`notice-bar`组件动画在低端安卓机可能会抖动的问题
|
||||
5. `u-loading-page`添加控制图标大小的属性`iconSize`
|
||||
6. 修复`u-tooltip`组件`color`参数不生效的问题
|
||||
7. 修复`u--input`组件使用`blur`事件输出为`undefined`的bug
|
||||
8. `u-code-input`组件新增键盘弹起时,是否自动上推页面参数`adjustPosition`
|
||||
9. 修复`image`组件`load`事件无回调对象问题
|
||||
10. 修复`button`组件`loadingSize`设置无效问题
|
||||
10. 其他修复
|
||||
## 2.0.31(2022-04-19)
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖
|
||||
|
||||
1. 修复`upload`在`vue`页面上传成功后没有成功标志的问题
|
||||
2. 解决演示项目中微信小程序模拟上传图片一直出于上传中问题
|
||||
3. 修复`u-code-input`组件在`nvue`页面编译到`app`平台上光标异常问题(`app`去除此功能)
|
||||
4. 修复`actionSheet`组件标题关闭按钮点击事件名称错误的问题
|
||||
5. 其他修复
|
||||
## 2.0.30(2022-04-04)
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖
|
||||
|
||||
|
|
|
@ -35,8 +35,9 @@
|
|||
:shape="shape"
|
||||
:customStyle="customStyle"
|
||||
:formatter="formatter"
|
||||
:ignoreCompositionEvent="ignoreCompositionEvent"
|
||||
@focus="$emit('focus')"
|
||||
@blur="$emit('blur')"
|
||||
@blur="e => $emit('blur', e)"
|
||||
@keyboardheightchange="$emit('keyboardheightchange')"
|
||||
@change="e => $emit('change', e)"
|
||||
@input="e => $emit('input', e)"
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
:border="border"
|
||||
:customStyle="customStyle"
|
||||
:formatter="formatter"
|
||||
:ignoreCompositionEvent="ignoreCompositionEvent"
|
||||
@focus="e => $emit('focus')"
|
||||
@blur="e => $emit('blur')"
|
||||
@linechange="e => $emit('linechange', e)"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<text class="u-action-sheet__header__title u-line-1">{{title}}</text>
|
||||
<view
|
||||
class="u-action-sheet__header__icon-wrap"
|
||||
@tap.stop="close"
|
||||
@tap.stop="cancel"
|
||||
>
|
||||
<u-icon
|
||||
name="close"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<template v-if="loading">
|
||||
<u-loading-icon
|
||||
:mode="loadingMode"
|
||||
:size="textSize * 1.15"
|
||||
:size="loadingSize * 1.15"
|
||||
:color="loadingColor"
|
||||
></u-loading-icon>
|
||||
<text
|
||||
|
@ -75,7 +75,7 @@
|
|||
<template v-if="loading">
|
||||
<u-loading-icon
|
||||
:mode="loadingMode"
|
||||
:size="textSize * 1.15"
|
||||
:size="loadingSize * 1.15"
|
||||
:color="loadingColor"
|
||||
></u-loading-icon>
|
||||
<text
|
||||
|
|
|
@ -209,12 +209,13 @@ export default {
|
|||
}
|
||||
},
|
||||
init() {
|
||||
// 校验maxDate,不能小于当前时间
|
||||
// 校验maxDate,不能小于minDate
|
||||
if (
|
||||
this.innerMaxDate &&
|
||||
new Date(this.innerMaxDate).getTime() <= Date.now()
|
||||
this.innerMinDate &&
|
||||
new Date(this.innerMaxDate).getTime() < new Date(this.innerMinDate).getTime()
|
||||
) {
|
||||
return uni.$u.error('maxDate不能小于当前时间')
|
||||
return uni.$u.error('maxDate不能小于minDate')
|
||||
}
|
||||
// 滚动区域的高度
|
||||
this.listHeight = this.rowHeight * 5 + 30
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
export default {
|
||||
props: {
|
||||
// 键盘弹起时,是否自动上推页面
|
||||
adjustPosition: {
|
||||
type: Boolean,
|
||||
default: uni.$u.props.codeInput.adjustPosition
|
||||
},
|
||||
// 最大输入长度
|
||||
maxlength: {
|
||||
type: [String, Number],
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
v-if="mode === 'line'"
|
||||
:style="[lineStyle]"
|
||||
></view>
|
||||
<view v-if="codeArray.length === index" :style="{backgroundColor: color}" class="u-code-input__item__cursor"></view>
|
||||
<!-- #ifndef APP-PLUS -->
|
||||
<view v-if="isFocus && codeArray.length === index" :style="{backgroundColor: color}" class="u-code-input__item__cursor"></view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
<input
|
||||
:disabled="disabledKeyboard"
|
||||
|
@ -31,11 +33,14 @@
|
|||
:focus="focus"
|
||||
:value="inputValue"
|
||||
:maxlength="maxlength"
|
||||
:adjustPosition="adjustPosition"
|
||||
class="u-code-input__input"
|
||||
@input="inputHandler"
|
||||
:style="{
|
||||
height: $u.addUnit(size)
|
||||
}"
|
||||
@focus="isFocus = true"
|
||||
@blur="isFocus = false"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
@ -70,7 +75,8 @@
|
|||
mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
|
||||
data() {
|
||||
return {
|
||||
inputValue: ''
|
||||
inputValue: '',
|
||||
isFocus: this.focus
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
@ -203,6 +209,7 @@
|
|||
width: 40px;
|
||||
background-color: $u-content-color;
|
||||
}
|
||||
/* #ifndef APP-PLUS */
|
||||
&__cursor {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
|
@ -212,6 +219,8 @@
|
|||
height: $u-code-input-cursor-height;
|
||||
animation: $u-code-input-cursor-animation-duration u-cursor-flicker infinite;
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
}
|
||||
|
||||
&__input {
|
||||
|
@ -226,6 +235,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
/* #ifndef APP-PLUS */
|
||||
@keyframes u-cursor-flicker {
|
||||
0% {
|
||||
opacity: 0;
|
||||
|
@ -237,4 +247,6 @@
|
|||
opacity: 0;
|
||||
}
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
</style>
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
* @property {String} endText 倒计结束的提示语,见官网说明(默认 '重新获取' )
|
||||
* @property {Boolean} keepRunning 是否在H5刷新或各端返回再进入时继续倒计时( 默认false )
|
||||
* @property {String} uniqueKey 为了区分多个页面,或者一个页面多个倒计时组件本地存储的继续倒计时变了
|
||||
*
|
||||
*
|
||||
* @event {Function} change 倒计时期间,每秒触发一次
|
||||
* @event {Function} start 开始倒计时触发
|
||||
* @event {Function} end 结束倒计时触发
|
||||
* @example <u-code ref="uCode" @change="codeChange" seconds="20"></u-code>
|
||||
* @example <u-code ref="uCode" @change="codeChange" seconds="20"></u-code>
|
||||
*/
|
||||
export default {
|
||||
name: "u-code",
|
||||
|
@ -74,7 +74,6 @@
|
|||
this.canGetCode = false
|
||||
// 这里放这句,是为了一开始时就提示,否则要等setInterval的1秒后才会有提示
|
||||
this.changeEvent(this.changeText.replace(/x|X/, this.secNum))
|
||||
this.setTimeToStorage()
|
||||
this.timer = setInterval(() => {
|
||||
if (--this.secNum) {
|
||||
// 用当前倒计时的秒数替换提示字符串中的"x"字母
|
||||
|
@ -88,7 +87,8 @@
|
|||
this.canGetCode = true
|
||||
}
|
||||
}, 1000)
|
||||
},
|
||||
this.setTimeToStorage()
|
||||
},
|
||||
// 重置,可以让用户再次获取验证码
|
||||
reset() {
|
||||
this.canGetCode = true
|
||||
|
|
|
@ -1,146 +1,127 @@
|
|||
<template>
|
||||
<view class="u-drawdown-item">
|
||||
<u-overlay
|
||||
customStyle="top: 126px"
|
||||
:show="show"
|
||||
:closeOnClickOverlay="closeOnClickOverlay"
|
||||
@click="overlayClick"
|
||||
></u-overlay>
|
||||
<view
|
||||
class="u-drawdown-item__content"
|
||||
:style="[style]"
|
||||
:animation="animationData"
|
||||
ref="animation"
|
||||
>
|
||||
<slot />
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-drawdown">
|
||||
<view
|
||||
class="u-dropdown__menu"
|
||||
:style="{
|
||||
height: $u.addUnit(height)
|
||||
}"
|
||||
ref="u-dropdown__menu"
|
||||
>
|
||||
<view
|
||||
class="u-dropdown__menu__item"
|
||||
v-for="(item, index) in menuList"
|
||||
:key="index"
|
||||
@tap.stop="clickHandler(item, index)"
|
||||
>
|
||||
<view class="u-dropdown__menu__item__content">
|
||||
<text
|
||||
class="u-dropdown__menu__item__content__text"
|
||||
:style="[index === current ? activeStyle : inactiveStyle]"
|
||||
>{{item.title}}</text>
|
||||
<view
|
||||
class="u-dropdown__menu__item__content__arrow"
|
||||
:class="[index === current && 'u-dropdown__menu__item__content__arrow--rotate']"
|
||||
>
|
||||
<u-icon
|
||||
:name="menuIcon"
|
||||
:size="$u.addUnit(menuIconSize)"
|
||||
></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-dropdown__content">
|
||||
<slot />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// #ifdef APP-NVUE
|
||||
const animation = uni.requireNativePlugin('animation')
|
||||
const dom = uni.requireNativePlugin('dom')
|
||||
// #endif
|
||||
import props from './props.js';
|
||||
/**
|
||||
* Drawdownitem
|
||||
* @description
|
||||
* @tutorial url
|
||||
* @property {String}
|
||||
* @event {Function}
|
||||
* @example
|
||||
*/
|
||||
export default {
|
||||
name: 'u-drawdown-item',
|
||||
mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
top: '126px',
|
||||
// uni.createAnimation的导出数据
|
||||
animationData: {},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init()
|
||||
},
|
||||
watch: {
|
||||
// 发生变化时,需要去更新父组件对应的值
|
||||
dataChange(newValue, oldValue) {
|
||||
this.updateParentData()
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 监听对应变量的变化
|
||||
dataChange() {
|
||||
return [this.title, this.disabled]
|
||||
},
|
||||
style() {
|
||||
const style = {
|
||||
zIndex: 10071,
|
||||
position: 'fixed',
|
||||
display: 'flex',
|
||||
left: 0,
|
||||
right: 0
|
||||
}
|
||||
style.top = uni.$u.addUnit(this.top)
|
||||
return style
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.updateParentData()
|
||||
},
|
||||
// 更新父组件所需的数据
|
||||
updateParentData() {
|
||||
// 获取父组件u-dropdown
|
||||
this.getParentData('u-dropdown')
|
||||
if (!this.parent) uni.$u.error('u-dropdown-item必须配合u-dropdown使用')
|
||||
// 查找父组件menuList数组中对应的标题数据
|
||||
const menuIndex = this.parent.menuList.findIndex(item => item.title === this.title)
|
||||
const menuContent = {
|
||||
title: this.title,
|
||||
disabled: this.disabled
|
||||
}
|
||||
if (menuIndex >= 0) {
|
||||
// 如果能找到,则直接修改
|
||||
this.parent.menuList[menuIndex] = menuContent;
|
||||
} else {
|
||||
// 如果无法找到,则为第一次添加,直接push即可
|
||||
this.parent.menuList.push(menuContent);
|
||||
}
|
||||
},
|
||||
async setContentAnimate(height) {
|
||||
this.animating = true
|
||||
// #ifdef APP-NVUE
|
||||
const ref = this.$refs['animation'].ref
|
||||
animation.transition(ref, {
|
||||
styles: {
|
||||
height: uni.$u.addUnit(height)
|
||||
},
|
||||
duration: this.duration,
|
||||
timingFunction: 'ease-in-out',
|
||||
}, () => {
|
||||
this.animating = false
|
||||
})
|
||||
// #endif
|
||||
|
||||
// #ifndef APP-NVUE
|
||||
const animation = uni.createAnimation({
|
||||
timingFunction: 'ease-in-out',
|
||||
});
|
||||
animation
|
||||
.height(height)
|
||||
.step({
|
||||
duration: this.duration,
|
||||
})
|
||||
.step()
|
||||
// 导出动画数据给面板的animationData值
|
||||
this.animationData = animation.export()
|
||||
// 标识动画结束
|
||||
uni.$u.sleep(this.duration).then(() => {
|
||||
this.animating = false
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
overlayClick() {
|
||||
this.show = false
|
||||
this.setContentAnimate(0)
|
||||
}
|
||||
},
|
||||
}
|
||||
import props from './props.js';
|
||||
/**
|
||||
* Dropdown
|
||||
* @description
|
||||
* @tutorial url
|
||||
* @property {String}
|
||||
* @event {Function}
|
||||
* @example
|
||||
*/
|
||||
export default {
|
||||
name: 'u-dropdown',
|
||||
mixins: [uni.$u.mixin, props],
|
||||
data() {
|
||||
return {
|
||||
// <EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
menuList: [],
|
||||
current: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
created() {
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(u-dropdown-item)<EFBFBD><EFBFBD>this<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>data<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
this.children = [];
|
||||
},
|
||||
methods: {
|
||||
clickHandler(item, index) {
|
||||
this.children.map(child => {
|
||||
if(child.title === item.title) {
|
||||
// this.queryRect('u-dropdown__menu').then(size => {
|
||||
child.$emit('click')
|
||||
child.setContentAnimate(child.show ? 0 : 300)
|
||||
child.show = !child.show
|
||||
// })
|
||||
} else {
|
||||
child.show = false
|
||||
child.setContentAnimate(0)
|
||||
}
|
||||
})
|
||||
},
|
||||
// <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>ǩ<EFBFBD>ijߴ<EFBFBD>λ<EFBFBD><EFBFBD>
|
||||
queryRect(el) {
|
||||
// #ifndef APP-NVUE
|
||||
// $uGetRectΪuView<EFBFBD>Դ<EFBFBD><EFBFBD>Ľڵ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD>https://www.uviewui.com/js/getRect.html
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>this.$uGetRect<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊthis.$u.getRect<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߹<EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>£<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD>ͬ
|
||||
return new Promise(resolve => {
|
||||
this.$uGetRect(`.${el}`).then(size => {
|
||||
resolve(size)
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
|
||||
// #ifdef APP-NVUE
|
||||
// nvue<EFBFBD>£<EFBFBD>ʹ<EFBFBD><EFBFBD>domģ<EFBFBD><EFBFBD><EFBFBD>ѯԪ<EFBFBD>ظ߶<EFBFBD>
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>promise<EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD>ô˷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>then<EFBFBD>ص<EFBFBD>
|
||||
return new Promise(resolve => {
|
||||
dom.getComponentRect(this.$refs[el], res => {
|
||||
resolve(res.size)
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '../../libs/css/components.scss';
|
||||
|
||||
.u-drawdown-item {
|
||||
|
||||
&__content {
|
||||
background-color: #FFFFFF;
|
||||
overflow: hidden;
|
||||
height: 0;
|
||||
}
|
||||
}
|
||||
<style lang="scss">
|
||||
@import '../../libs/css/components.scss';
|
||||
|
||||
.u-dropdown {
|
||||
|
||||
&__menu {
|
||||
@include flex;
|
||||
|
||||
&__item {
|
||||
flex: 1;
|
||||
@include flex;
|
||||
justify-content: center;
|
||||
|
||||
&__content {
|
||||
@include flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,127 +1,127 @@
|
|||
<template>
|
||||
<view class="u-drawdown">
|
||||
<view
|
||||
class="u-dropdown__menu"
|
||||
:style="{
|
||||
<view class="u-drawdown">
|
||||
<view
|
||||
class="u-dropdown__menu"
|
||||
:style="{
|
||||
height: $u.addUnit(height)
|
||||
}"
|
||||
ref="u-dropdown__menu"
|
||||
>
|
||||
<view
|
||||
class="u-dropdown__menu__item"
|
||||
v-for="(item, index) in menuList"
|
||||
:key="index"
|
||||
@tap.stop="clickHandler(item, index)"
|
||||
>
|
||||
<view class="u-dropdown__menu__item__content">
|
||||
<text
|
||||
class="u-dropdown__menu__item__content__text"
|
||||
:style="[index === current ? activeStyle : inactiveStyle]"
|
||||
>{{item.title}}</text>
|
||||
<view
|
||||
class="u-dropdown__menu__item__content__arrow"
|
||||
:class="[index === current && 'u-dropdown__menu__item__content__arrow--rotate']"
|
||||
>
|
||||
<u-icon
|
||||
:name="menuIcon"
|
||||
:size="$u.addUnit(menuIconSize)"
|
||||
></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-dropdown__content">
|
||||
<slot />
|
||||
</view>
|
||||
</view>
|
||||
ref="u-dropdown__menu"
|
||||
>
|
||||
<view
|
||||
class="u-dropdown__menu__item"
|
||||
v-for="(item, index) in menuList"
|
||||
:key="index"
|
||||
@tap.stop="clickHandler(item, index)"
|
||||
>
|
||||
<view class="u-dropdown__menu__item__content">
|
||||
<text
|
||||
class="u-dropdown__menu__item__content__text"
|
||||
:style="[index === current ? activeStyle : inactiveStyle]"
|
||||
>{{item.title}}</text>
|
||||
<view
|
||||
class="u-dropdown__menu__item__content__arrow"
|
||||
:class="[index === current && 'u-dropdown__menu__item__content__arrow--rotate']"
|
||||
>
|
||||
<u-icon
|
||||
:name="menuIcon"
|
||||
:size="$u.addUnit(menuIconSize)"
|
||||
></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-dropdown__content">
|
||||
<slot />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import props from './props.js';
|
||||
/**
|
||||
* Dropdown
|
||||
* @description
|
||||
* @tutorial url
|
||||
* @property {String}
|
||||
* @event {Function}
|
||||
* @example
|
||||
*/
|
||||
export default {
|
||||
name: 'u-dropdown',
|
||||
mixins: [uni.$u.mixin, props],
|
||||
data() {
|
||||
return {
|
||||
// 菜单数组
|
||||
menuList: [],
|
||||
current: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
created() {
|
||||
// 引用所有子组件(u-dropdown-item)的this,不能在data中声明变量,否则在微信小程序会造成循环引用而报错
|
||||
this.children = [];
|
||||
},
|
||||
methods: {
|
||||
clickHandler(item, index) {
|
||||
this.children.map(child => {
|
||||
if(child.title === item.title) {
|
||||
// this.queryRect('u-dropdown__menu').then(size => {
|
||||
child.$emit('click')
|
||||
child.setContentAnimate(child.show ? 0 : 300)
|
||||
child.show = !child.show
|
||||
// })
|
||||
} else {
|
||||
child.show = false
|
||||
child.setContentAnimate(0)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取标签的尺寸位置
|
||||
queryRect(el) {
|
||||
// #ifndef APP-NVUE
|
||||
// $uGetRect为uView自带的节点查询简化方法,详见文档介绍:https://www.uviewui.com/js/getRect.html
|
||||
// 组件内部一般用this.$uGetRect,对外的为this.$u.getRect,二者功能一致,名称不同
|
||||
return new Promise(resolve => {
|
||||
this.$uGetRect(`.${el}`).then(size => {
|
||||
resolve(size)
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
|
||||
// #ifdef APP-NVUE
|
||||
// nvue下,使用dom模块查询元素高度
|
||||
// 返回一个promise,让调用此方法的主体能使用then回调
|
||||
return new Promise(resolve => {
|
||||
dom.getComponentRect(this.$refs[el], res => {
|
||||
resolve(res.size)
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
},
|
||||
}
|
||||
import props from './props.js';
|
||||
/**
|
||||
* Dropdown
|
||||
* @description
|
||||
* @tutorial url
|
||||
* @property {String}
|
||||
* @event {Function}
|
||||
* @example
|
||||
*/
|
||||
export default {
|
||||
name: 'u-dropdown',
|
||||
mixins: [uni.$u.mixin, props],
|
||||
data() {
|
||||
return {
|
||||
// <EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
menuList: [],
|
||||
current: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
created() {
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(u-dropdown-item)<EFBFBD><EFBFBD>this<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>data<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
this.children = [];
|
||||
},
|
||||
methods: {
|
||||
clickHandler(item, index) {
|
||||
this.children.map(child => {
|
||||
if(child.title === item.title) {
|
||||
// this.queryRect('u-dropdown__menu').then(size => {
|
||||
child.$emit('click')
|
||||
child.setContentAnimate(child.show ? 0 : 300)
|
||||
child.show = !child.show
|
||||
// })
|
||||
} else {
|
||||
child.show = false
|
||||
child.setContentAnimate(0)
|
||||
}
|
||||
})
|
||||
},
|
||||
// <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>ǩ<EFBFBD>ijߴ<EFBFBD>λ<EFBFBD><EFBFBD>
|
||||
queryRect(el) {
|
||||
// #ifndef APP-NVUE
|
||||
// $uGetRectΪuView<EFBFBD>Դ<EFBFBD><EFBFBD>Ľڵ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD>https://www.uviewui.com/js/getRect.html
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>this.$uGetRect<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊthis.$u.getRect<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߹<EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>£<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD>ͬ
|
||||
return new Promise(resolve => {
|
||||
this.$uGetRect(`.${el}`).then(size => {
|
||||
resolve(size)
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
|
||||
// #ifdef APP-NVUE
|
||||
// nvue<EFBFBD>£<EFBFBD>ʹ<EFBFBD><EFBFBD>domģ<EFBFBD><EFBFBD><EFBFBD>ѯԪ<EFBFBD>ظ߶<EFBFBD>
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>promise<EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD>ô˷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>then<EFBFBD>ص<EFBFBD>
|
||||
return new Promise(resolve => {
|
||||
dom.getComponentRect(this.$refs[el], res => {
|
||||
resolve(res.size)
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import '../../libs/css/components.scss';
|
||||
@import '../../libs/css/components.scss';
|
||||
|
||||
.u-dropdown {
|
||||
|
||||
&__menu {
|
||||
@include flex;
|
||||
|
||||
&__item {
|
||||
flex: 1;
|
||||
@include flex;
|
||||
justify-content: center;
|
||||
|
||||
&__content {
|
||||
@include flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.u-dropdown {
|
||||
|
||||
&__menu {
|
||||
@include flex;
|
||||
|
||||
&__item {
|
||||
flex: 1;
|
||||
@include flex;
|
||||
justify-content: center;
|
||||
|
||||
&__content {
|
||||
@include flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -15,6 +15,11 @@ export default {
|
|||
type: [String, Boolean],
|
||||
default: uni.$u.props.formItem.borderBottom
|
||||
},
|
||||
// label的位置,left-左边,top-上边
|
||||
labelPosition: {
|
||||
type: String,
|
||||
default: uni.$u.props.formItem.labelPosition
|
||||
},
|
||||
// label的宽度,单位px
|
||||
labelWidth: {
|
||||
type: [String, Number],
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
class="u-form-item__body"
|
||||
@tap="clickHandler"
|
||||
:style="[$u.addStyle(customStyle), {
|
||||
flexDirection: parentData.labelPosition === 'left' ? 'row' : 'column'
|
||||
flexDirection: (labelPosition || parentData.labelPosition) === 'left' ? 'row' : 'column'
|
||||
}]"
|
||||
>
|
||||
<!-- 微信小程序中,将一个参数设置空字符串,结果会变成字符串"true" -->
|
||||
|
|
|
@ -161,10 +161,10 @@
|
|||
this.$emit('error', err)
|
||||
},
|
||||
// 图片加载完成,标记loading结束
|
||||
onLoadHandler() {
|
||||
onLoadHandler(event) {
|
||||
this.loading = false
|
||||
this.isError = false
|
||||
this.$emit('load')
|
||||
this.$emit('load', event)
|
||||
this.removeBgColor()
|
||||
// 如果不需要动画效果,就不执行下方代码,同时移除加载时的背景颜色
|
||||
// 否则无需fade效果时,png图片依然能看到下方的背景色
|
||||
|
|
|
@ -177,6 +177,11 @@ export default {
|
|||
formatter: {
|
||||
type: [Function, null],
|
||||
default: uni.$u.props.input.formatter
|
||||
},
|
||||
// 是否忽略组件内对文本合成系统事件的处理
|
||||
ignoreCompositionEvent: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
:selection-end="selectionEnd"
|
||||
:selection-start="selectionStart"
|
||||
:password="password || type === 'password' || undefined"
|
||||
:ignoreCompositionEvent="ignoreCompositionEvent"
|
||||
@input="onInput"
|
||||
@blur="onBlur"
|
||||
@focus="onFocus"
|
||||
|
@ -114,7 +115,7 @@ import props from "./props.js";
|
|||
* @property {Boolean} readonly 是否只读,与disabled不同之处在于disabled会置灰组件,而readonly则不会 ( 默认 false )
|
||||
* @property {String} shape 输入框形状,circle-圆形,square-方形 ( 默认 'square' )
|
||||
* @property {Object} customStyle 定义需要用到的外部样式
|
||||
*
|
||||
* @property {Boolean} ignoreCompositionEvent 是否忽略组件内对文本合成系统事件的处理。
|
||||
* @example <u-input v-model="value" :password="true" suffix-icon="lock-fill" />
|
||||
*/
|
||||
export default {
|
||||
|
|
|
@ -24,7 +24,7 @@ export default {
|
|||
type: [String, Number],
|
||||
default: uni.$u.props.line.margin
|
||||
},
|
||||
// 是否虚线,true-实线,false-虚线
|
||||
// 是否虚线,true-虚线,false-实线
|
||||
dashed: {
|
||||
type: Boolean,
|
||||
default: uni.$u.props.line.dashed
|
||||
|
|
|
@ -29,9 +29,7 @@
|
|||
@scrolltolower="scrolltolower"
|
||||
@scrolltoupper="scrolltoupper"
|
||||
>
|
||||
<view :style="{
|
||||
paddingTop: `${offset}px`
|
||||
}">
|
||||
<view>
|
||||
<slot />
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
|
|
@ -35,6 +35,11 @@ export default {
|
|||
type: [String, Number],
|
||||
default: uni.$u.props.loadingPage.fontSize
|
||||
},
|
||||
// 图标大小
|
||||
iconSize: {
|
||||
type: [String, Number],
|
||||
default: uni.$u.props.loadingPage.fontSize
|
||||
},
|
||||
// 加载中图标的颜色,只能rgb或者十六进制颜色值
|
||||
loadingColor: {
|
||||
type: String,
|
||||
|
|
|
@ -19,11 +19,15 @@
|
|||
:src="image"
|
||||
class="u-loading-page__warpper__loading-icon__img"
|
||||
mode="widthFit"
|
||||
:style="{
|
||||
width: $u.addUnit(iconSize),
|
||||
height: $u.addUnit(iconSize)
|
||||
}"
|
||||
></image>
|
||||
<u-loading-icon
|
||||
v-else
|
||||
:mode="loadingMode"
|
||||
size="28"
|
||||
:size="$u.addUnit(iconSize)"
|
||||
:color="loadingColor"
|
||||
></u-loading-icon>
|
||||
</view>
|
||||
|
@ -55,6 +59,7 @@ import props from "./props.js";
|
|||
* @property {String} bgColor 背景色 (默认 '#ffffff' )
|
||||
* @property {String} color 文字颜色 (默认 '#C8C8C8' )
|
||||
* @property {String | Number} fontSize 文字大小 (默认 19 )
|
||||
* @property {String | Number} iconSize 图标大小 (默认 28 )
|
||||
* @property {String} loadingColor 加载中图标的颜色,只能rgb或者十六进制颜色值 (默认 '#C8C8C8' )
|
||||
* @property {Object} customStyle 自定义样式
|
||||
* @example <u-loading mode="circle"></u-loading>
|
||||
|
|
|
@ -19,13 +19,17 @@ export default {
|
|||
fontSize: {
|
||||
type: [String, Number],
|
||||
default: uni.$u.props.loadmore.fontSize
|
||||
},
|
||||
// 图标大小
|
||||
iconSize: {
|
||||
type: [String, Number],
|
||||
default: uni.$u.props.loadmore.iconSize
|
||||
},
|
||||
// 字体颜色
|
||||
color: {
|
||||
type: String,
|
||||
default: uni.$u.props.loadmore.color
|
||||
},
|
||||
|
||||
// 加载中状态的图标,spinner-花朵状图标,circle-圆圈状,semicircle-半圆
|
||||
loadingIcon: {
|
||||
type: String,
|
||||
|
@ -75,6 +79,16 @@ export default {
|
|||
line: {
|
||||
type: Boolean,
|
||||
default: uni.$u.props.loadmore.line
|
||||
},
|
||||
// 线条颜色
|
||||
lineColor: {
|
||||
type: String,
|
||||
default: uni.$u.props.loadmore.lineColor
|
||||
},
|
||||
// 是否虚线,true-虚线,false-实线
|
||||
dashed: {
|
||||
type: Boolean,
|
||||
default: uni.$u.props.loadmore.dashed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,9 @@
|
|||
>
|
||||
<u-line
|
||||
length="140rpx"
|
||||
color="#E6E8EB"
|
||||
:color="lineColor"
|
||||
:hairline="false"
|
||||
:dashed="dashed"
|
||||
v-if="line"
|
||||
></u-line>
|
||||
<!-- 加载中和没有更多的状态才显示两边的横线 -->
|
||||
|
@ -28,7 +29,7 @@
|
|||
>
|
||||
<u-loading-icon
|
||||
:color="iconColor"
|
||||
size="17"
|
||||
:size="iconSize"
|
||||
:mode="loadingIcon"
|
||||
></u-loading-icon>
|
||||
</view>
|
||||
|
@ -42,8 +43,9 @@
|
|||
</view>
|
||||
<u-line
|
||||
length="140rpx"
|
||||
color="#E6E8EB"
|
||||
:color="lineColor"
|
||||
:hairline="false"
|
||||
:dashed="dashed"
|
||||
v-if="line"
|
||||
></u-line>
|
||||
</view>
|
||||
|
@ -60,6 +62,7 @@
|
|||
* @property {String} bgColor 组件背景颜色,在页面是非白色时会用到(默认 'transparent' )
|
||||
* @property {Boolean} icon 加载中时是否显示图标(默认 true )
|
||||
* @property {String | Number} fontSize 字体大小(默认 14 )
|
||||
* @property {String | Number} iconSize 图标大小(默认 17 )
|
||||
* @property {String} color 字体颜色(默认 '#606266' )
|
||||
* @property {String} loadingIcon 加载图标(默认 'circle' )
|
||||
* @property {String} loadmoreText 加载前的提示语(默认 '加载更多' )
|
||||
|
@ -67,10 +70,12 @@
|
|||
* @property {String} nomoreText 没有更多的提示语(默认 '没有更多了' )
|
||||
* @property {Boolean} isDot 到上一个相邻元素的距离 (默认 false )
|
||||
* @property {String} iconColor 加载中图标的颜色 (默认 '#b7b7b7' )
|
||||
* @property {String} lineColor 线条颜色(默认 #E6E8EB )
|
||||
* @property {String | Number} marginTop 上边距 (默认 10 )
|
||||
* @property {String | Number} marginBottom 下边距 (默认 10 )
|
||||
* @property {String | Number} height 高度,单位px (默认 'auto' )
|
||||
* @property {Boolean} line 是否显示左边分割线 (默认 false )
|
||||
* @property {Boolean} dashed // 是否虚线,true-虚线,false-实线 (默认 false )
|
||||
* @event {Function} loadmore status为loadmore时,点击组件会发出此事件
|
||||
* @example <u-loadmore :status="status" icon-type="iconType" load-text="loadText" />
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<template>
|
||||
<u-overlay
|
||||
:show="!isConnected"
|
||||
:zIndex="zIndex"
|
||||
@touchmove.stop.prevent="noop"
|
||||
:customStyle="{
|
||||
backgroundColor: '#fff',
|
||||
|
|
|
@ -201,7 +201,7 @@ export default {
|
|||
// #ifdef H5 || APP-PLUS
|
||||
node.attrs.src = node.attrs.src || node.attrs['data-src']
|
||||
// #endif
|
||||
this.root.$emit('imgtap', node.attrs)
|
||||
this.root.$emit('imgTap', node.attrs)
|
||||
// 自动预览图片
|
||||
if (this.root.previewImg)
|
||||
uni.previewImage({
|
||||
|
@ -262,7 +262,7 @@ export default {
|
|||
linkTap(e) {
|
||||
var attrs = e.currentTarget ? this.childs[e.currentTarget.dataset.i].attrs : e,
|
||||
href = attrs.href
|
||||
this.root.$emit('linktap', attrs)
|
||||
this.root.$emit('linkTap', attrs)
|
||||
if (href) {
|
||||
// 跳转锚点
|
||||
if (href[0] == '#')
|
||||
|
@ -496,4 +496,4 @@ export default {
|
|||
height: 225px;
|
||||
}
|
||||
/* #endif */
|
||||
</style>
|
||||
</style>
|
||||
|
|
|
@ -50,11 +50,6 @@ export default {
|
|||
type: String,
|
||||
default: uni.$u.props.picker.confirmColor
|
||||
},
|
||||
// 选择器只有一列时,默认选中项的索引,从0开始
|
||||
singleIndex: {
|
||||
type: [String, Number],
|
||||
default: uni.$u.props.picker.singleIndex
|
||||
},
|
||||
// 每列中可见选项的数量
|
||||
visibleItemCount: {
|
||||
type: [String, Number],
|
||||
|
|
|
@ -66,7 +66,6 @@
|
|||
* @property {String} confirmText 确认按钮的文字(默认 '确定' )
|
||||
* @property {String} cancelColor 取消按钮的颜色(默认 '#909193' )
|
||||
* @property {String} confirmColor 确认按钮的颜色(默认 '#3c9cff' )
|
||||
* @property {Array} singleIndex 选择器只有一列时,默认选中项的索引,从0开始(默认 0 )
|
||||
* @property {String | Number} visibleItemCount 每列中可见选项的数量(默认 5 )
|
||||
* @property {String} keyName 选项对象中,需要展示的属性键名(默认 'text' )
|
||||
* @property {Boolean} closeOnClickOverlay 是否允许点击遮罩关闭选择器(默认 false )
|
||||
|
@ -161,7 +160,7 @@ export default {
|
|||
this.setIndexs(value)
|
||||
|
||||
this.$emit('change', {
|
||||
// #ifndef MP-WEIXIN
|
||||
// #ifndef MP-WEIXIN || MP-LARK
|
||||
// 微信小程序不能传递this,会因为循环引用而报错
|
||||
picker: this,
|
||||
// #endif
|
||||
|
|
|
@ -20,15 +20,17 @@
|
|||
/>
|
||||
</slot>
|
||||
</view>
|
||||
<text
|
||||
class="u-radio__text"
|
||||
@tap.stop="labelClickHandler"
|
||||
:style="{
|
||||
color: elDisabled ? elInactiveColor : elLabelColor,
|
||||
fontSize: elLabelSize,
|
||||
lineHeight: elLabelSize
|
||||
}"
|
||||
>{{label}}</text>
|
||||
<slot>
|
||||
<text
|
||||
class="u-radio__text"
|
||||
@tap.stop="labelClickHandler"
|
||||
:style="{
|
||||
color: elDisabled ? elInactiveColor : elLabelColor,
|
||||
fontSize: elLabelSize,
|
||||
lineHeight: elLabelSize
|
||||
}"
|
||||
>{{label}}</text>
|
||||
</slot>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
: inactiveColor
|
||||
"
|
||||
:custom-style="{
|
||||
padding: `0 ${$u.addUnit(gutter / 2)}`,
|
||||
'padding-left': $u.addUnit(gutter / 2),
|
||||
'padding-right': $u.addUnit(gutter / 2)
|
||||
}"
|
||||
:size="size"
|
||||
></u-icon>
|
||||
|
@ -63,7 +64,8 @@
|
|||
: inactiveColor
|
||||
"
|
||||
:custom-style="{
|
||||
padding: `0 ${$u.addUnit(gutter / 2)}`
|
||||
'padding-left': $u.addUnit(gutter / 2),
|
||||
'padding-right': $u.addUnit(gutter / 2)
|
||||
}"
|
||||
:size="size"
|
||||
></u-icon>
|
||||
|
|
|
@ -19,11 +19,17 @@
|
|||
class="u-notice__content"
|
||||
ref="u-notice__content"
|
||||
>
|
||||
<text
|
||||
<view
|
||||
ref="u-notice__content__text"
|
||||
class="u-notice__content__text"
|
||||
:style="[textStyle]"
|
||||
>{{text}}</text>
|
||||
:style="[animationStyle]"
|
||||
>
|
||||
<text
|
||||
v-for="(item, index) in innerText"
|
||||
:key="index"
|
||||
:style="[textStyle]"
|
||||
>{{item}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="u-notice__right-icon"
|
||||
|
@ -118,11 +124,28 @@
|
|||
textStyle() {
|
||||
let style = {}
|
||||
style.color = this.color
|
||||
style.animationDuration = this.animationDuration
|
||||
style.animationPlayState = this.animationPlayState
|
||||
style.fontSize = uni.$u.addUnit(this.fontSize)
|
||||
return style
|
||||
},
|
||||
animationStyle() {
|
||||
let style = {}
|
||||
style.animationDuration = this.animationDuration
|
||||
style.animationPlayState = this.animationPlayState
|
||||
return style
|
||||
},
|
||||
// 内部对用户传入的数据进一步分割,放到多个text标签循环,否则如果用户传入的字符串很长(100个字符以上)
|
||||
// 放在一个text标签中进行滚动,在低端安卓机上,动画可能会出现抖动现象,需要分割到多个text中可解决此问题
|
||||
innerText() {
|
||||
let result = [],
|
||||
// 每组text标签的字符长度
|
||||
len = 20
|
||||
const textArr = this.text.split('')
|
||||
for (let i = 0; i < textArr.length; i += len) {
|
||||
// 对拆分的后的text进行slice分割,得到的为数组再进行join拼接为字符串
|
||||
result.push(textArr.slice(i, i + len).join(''))
|
||||
}
|
||||
return result
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// #ifdef APP-PLUS
|
||||
|
@ -289,6 +312,7 @@
|
|||
white-space: nowrap;
|
||||
animation: u-loop-animation 10s linear infinite both;
|
||||
/* #endif */
|
||||
@include flex(row);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,13 +72,11 @@
|
|||
</view>
|
||||
</template>
|
||||
|
||||
<!-- #ifndef APP-NVUE || MP-WEIXIN || H5 || APP-VUE || MP-QQ -->
|
||||
<script
|
||||
src="./scrollWxs.wxs"
|
||||
module="wxs"
|
||||
lang="wxs"
|
||||
></script>
|
||||
<!-- #endif -->
|
||||
|
||||
<script>
|
||||
/**
|
||||
|
|
|
@ -148,7 +148,7 @@
|
|||
position: relative;
|
||||
overflow: hidden;
|
||||
/* #ifndef APP-NVUE || MP-WEIXIN */
|
||||
touch-action: none;
|
||||
touch-action: pan-y;
|
||||
/* #endif */
|
||||
|
||||
&__content {
|
||||
|
|
|
@ -109,6 +109,11 @@ export default {
|
|||
formatter: {
|
||||
type: [Function, null],
|
||||
default: uni.$u.props.textarea.formatter
|
||||
},
|
||||
// 是否忽略组件内对文本合成系统事件的处理
|
||||
ignoreCompositionEvent: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
:holdKeyboard="holdKeyboard"
|
||||
:maxlength="maxlength"
|
||||
:confirmType="confirmType"
|
||||
:ignoreCompositionEvent="ignoreCompositionEvent"
|
||||
@focus="onFocus"
|
||||
@blur="onBlur"
|
||||
@linechange="onLinechange"
|
||||
|
@ -68,6 +69,7 @@ import props from "./props.js";
|
|||
* @property {Boolean} holdKeyboard focus时,点击页面的时候不收起键盘,只微信小程序有效(默认 false )
|
||||
* @property {String | Number} maxlength 最大输入长度,设置为 -1 的时候不限制最大长度(默认 140 )
|
||||
* @property {String} border 边框类型,surround-四周边框,none-无边框,bottom-底部边框(默认 'surround' )
|
||||
* @property {Boolean} ignoreCompositionEvent 是否忽略组件内对文本合成系统事件的处理
|
||||
*
|
||||
* @event {Function(e)} focus 输入框聚焦时触发,event.detail = { value, height },height 为键盘高度
|
||||
* @event {Function(e)} blur 输入框失去焦点时触发,event.detail = {value, cursor}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
:selectable="false"
|
||||
@longpress.stop="longpressHandler"
|
||||
:style="{
|
||||
color: color,
|
||||
backgroundColor: bgColor && showTooltip && tooltipTop !== -10000 ? bgColor : 'transparent'
|
||||
}"
|
||||
>{{ text }}</text>
|
||||
|
@ -312,7 +313,6 @@
|
|||
/* #endif */
|
||||
|
||||
&__text {
|
||||
color: $u-content-color;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
|
|
|
@ -374,6 +374,7 @@
|
|||
$u-upload-deletable-zIndex:3 !default;
|
||||
$u-upload-success-bottom:0 !default;
|
||||
$u-upload-success-right:0 !default;
|
||||
$u-upload-success-border-style:solid !default;
|
||||
$u-upload-success-border-top-color:transparent !default;
|
||||
$u-upload-success-border-left-color:transparent !default;
|
||||
$u-upload-success-border-bottom-color: $u-success !default;
|
||||
|
@ -479,6 +480,7 @@
|
|||
// 由于weex(nvue)为阿里巴巴的KPI(部门业绩考核)的laji产物,不支持css绘制三角形
|
||||
// 所以在nvue下使用图片,非nvue下使用css实现
|
||||
/* #ifndef APP-NVUE */
|
||||
border-style: $u-upload-success-border-style;
|
||||
border-top-color: $u-upload-success-border-top-color;
|
||||
border-left-color: $u-upload-success-border-left-color;
|
||||
border-bottom-color: $u-upload-success-border-bottom-color;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// 此版本发布于2022-04-04
|
||||
const version = '2.0.30'
|
||||
// 此版本发布于2022-00-24
|
||||
const version = '2.0.34'
|
||||
|
||||
// 开发环境才提示,生产环境不会提示
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
console.log(`\n %c uView V${version} %c https://www.uviewui.com/ \n\n`, 'color: #ffffff; background: #3c9cff; padding:5px 0;', 'color: #3c9cff;background: #ffffff; padding:5px 0;');
|
||||
console.log(`\n %c uView V${version} %c https://uviewui.com/ \n\n`, 'color: #ffffff; background: #3c9cff; padding:5px 0; border-radius: 5px;');
|
||||
}
|
||||
|
||||
export default {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
export default {
|
||||
// codeInput 组件
|
||||
codeInput: {
|
||||
adjustPosition: true,
|
||||
maxlength: 6,
|
||||
dot: false,
|
||||
mode: 'box',
|
||||
|
|
|
@ -13,6 +13,7 @@ export default {
|
|||
label: '',
|
||||
prop: '',
|
||||
borderBottom: '',
|
||||
labelPosition: '',
|
||||
labelWidth: '',
|
||||
rightIcon: '',
|
||||
leftIcon: '',
|
||||
|
|
|
@ -17,6 +17,7 @@ export default {
|
|||
bgColor: '#ffffff',
|
||||
color: '#C8C8C8',
|
||||
fontSize: 19,
|
||||
iconSize: 28,
|
||||
loadingColor: '#C8C8C8'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ export default {
|
|||
bgColor: 'transparent',
|
||||
icon: true,
|
||||
fontSize: 14,
|
||||
iconSize: 17,
|
||||
color: '#606266',
|
||||
loadingIcon: 'spinner',
|
||||
loadmoreText: '加载更多',
|
||||
|
@ -24,6 +25,8 @@ export default {
|
|||
marginTop: 10,
|
||||
marginBottom: 10,
|
||||
height: 'auto',
|
||||
line: false
|
||||
line: false,
|
||||
lineColor: '#E6E8EB',
|
||||
dashed: false,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ export default {
|
|||
confirmText: '确定',
|
||||
cancelColor: '#909193',
|
||||
confirmColor: '#3c9cff',
|
||||
singleIndex: 0,
|
||||
visibleItemCount: 5,
|
||||
keyName: 'text',
|
||||
closeOnClickOverlay: false,
|
||||
|
|
|
@ -15,7 +15,7 @@ export default {
|
|||
placeholderClass: 'textarea-placeholder',
|
||||
placeholderStyle: 'color: #c0c4cc',
|
||||
height: 70,
|
||||
confirmType: '',
|
||||
confirmType: 'done',
|
||||
disabled: false,
|
||||
count: false,
|
||||
focus: false,
|
||||
|
|
|
@ -292,15 +292,15 @@ if (!String.prototype.padStart) {
|
|||
else if (typeof dateTime === 'string' && /^\d+$/.test(dateTime.trim())) {
|
||||
date = new Date(Number(dateTime))
|
||||
}
|
||||
// 其他都认为符合 RFC 2822 规范
|
||||
else {
|
||||
// 处理平台性差异,在Safari/Webkit中,new Date仅支持/作为分割符的字符串时间
|
||||
date = new Date(
|
||||
typeof dateTime === 'string'
|
||||
? dateTime.replace(/-/g, '/')
|
||||
: dateTime
|
||||
)
|
||||
}
|
||||
// 处理平台性差异,在Safari/Webkit中,new Date仅支持/作为分割符的字符串时间
|
||||
// 处理 '2022-07-10 01:02:03',跳过 '2022-07-10T01:02:03'
|
||||
else if (typeof dateTime === 'string' && dateTime.includes('-') && !dateTime.includes('T')) {
|
||||
date = new Date(dateTime.replace(/-/g, '/'))
|
||||
}
|
||||
// 其他都认为符合 RFC 2822 规范
|
||||
else {
|
||||
date = new Date(dateTime)
|
||||
}
|
||||
|
||||
const timeSource = {
|
||||
'y': date.getFullYear().toString(), // 年
|
||||
|
|
|
@ -9,7 +9,7 @@ function email(value) {
|
|||
* 验证手机格式
|
||||
*/
|
||||
function mobile(value) {
|
||||
return /^1[23456789]\d{9}$/.test(value)
|
||||
return /^1([3589]\d|4[5-9]|6[1-2,4-7]|7[0-8])\d{8}$/.test(value)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -77,7 +77,7 @@ module.exports = {
|
|||
}
|
||||
return Object.keys(classes)
|
||||
// 支付宝,头条小程序无法动态绑定一个数组类名,否则解析出来的结果会带有",",而导致失效
|
||||
// #ifdef MP-ALIPAY || MP-TOUTIAO
|
||||
// #ifdef MP-ALIPAY || MP-TOUTIAO || MP-LARK
|
||||
.join(' ')
|
||||
// #endif
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ class Router {
|
|||
mergeConfig.url = this.mixinParam(options, params)
|
||||
mergeConfig.type = 'navigateTo'
|
||||
} else {
|
||||
mergeConfig = uni.$u.deepClone(options, this.config)
|
||||
mergeConfig = uni.$u.deepMerge(options, this.config)
|
||||
// 否则正常使用mergeConfig中的url和params进行拼接
|
||||
mergeConfig.url = this.mixinParam(options.url, options.params)
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "uview-ui",
|
||||
"name": "uview-ui",
|
||||
"displayName": "uView2.0重磅发布,利剑出鞘,一统江湖",
|
||||
"version": "2.0.30",
|
||||
"version": "2.0.34",
|
||||
"description": "uView UI已完美兼容nvue,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
|
||||
"keywords": [
|
||||
"uview",
|
||||
|
@ -17,12 +17,8 @@
|
|||
"engines": {
|
||||
"HBuilderX": "^3.1.0"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"sale": {
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
},
|
||||
|
@ -38,7 +34,8 @@
|
|||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/uview-ui"
|
||||
"npmurl": "https://www.npmjs.com/package/uview-ui",
|
||||
"type": "component-vue"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [],
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
// 引入配置
|
||||
import config from '@/common/config'
|
||||
// 初始化请求配置
|
||||
uni.$u.http.setConfig((defaultConfig) => {
|
||||
/* defaultConfig 为默认全局配置 */
|
||||
defaultConfig.baseURL = config.baseUrl /* 根域名 */
|
||||
defaultConfig.header = config.header
|
||||
return defaultConfig
|
||||
})
|
||||
|
||||
module.exports = (vm) => {
|
||||
require('./requestInterceptors')(vm)
|
||||
require('./responseInterceptors')(vm)
|
||||
}
|
Loading…
Reference in New Issue