13 changed files with 1335 additions and 113 deletions
Unified View
Diff Options
-
24components/u-gap/u-gap.vue
-
276pages.json
-
22pages/client-detail/base-paper-deals.vue
-
238pages/client-detail/basic-information.vue
-
45pages/client-detail/custom-header.vue
-
22pages/client-detail/equipment-information.vue
-
80pages/client-detail/index.vue
-
464pages/client-detail/news-item.nvue
-
22pages/client-detail/waste-paper-trading.vue
-
9uni_modules/uni-segmented-control/changelog.md
-
146uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.vue
-
87uni_modules/uni-segmented-control/package.json
-
13uni_modules/uni-segmented-control/readme.md
@ -0,0 +1,24 @@ |
|||||
|
<template> |
||||
|
<view class="gap"></view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
|
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
.gap { |
||||
|
height: 20rpx; |
||||
|
width: 100%; |
||||
|
background: #f4f4f5; |
||||
|
} |
||||
|
</style> |
||||
@ -1,115 +1,165 @@ |
|||||
{ |
{ |
||||
"pages": [ |
|
||||
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages |
|
||||
{ |
|
||||
"path": "pages/client/index", |
|
||||
"style": { |
|
||||
"navigationBarTitleText": "客户", |
|
||||
"navigationStyle": "custom" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"path": "pages/client-list/index", |
|
||||
"style": { |
|
||||
"navigationBarTitleText": "客户列表", |
|
||||
"navigationStyle": "custom" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"path": "pages/search/index", |
|
||||
"style": { |
|
||||
"navigationBarTitleText": "客户搜索", |
|
||||
"navigationStyle": "custom" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"path": "pages/add-user/index", |
|
||||
"style": { |
|
||||
"navigationBarTitleText": "添加客户", |
|
||||
"navigationStyle": "custom" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"path": "pages/trade/index", |
|
||||
"style": { |
|
||||
"navigationBarTitleText": "交易" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"path": "pages/mall/index", |
|
||||
"style": { |
|
||||
"navigationBarTitleText": "商城" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"path": "pages/mine/index", |
|
||||
"style": { |
|
||||
"navigationBarTitleText": "我的" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"path": "pages/login/index", |
|
||||
"style": { |
|
||||
"navigationBarTitleText": "登录", |
|
||||
"enablePullDownRefresh": false, |
|
||||
"navigationStyle": "custom" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"path": "pages/agreement/index", |
|
||||
"style": { |
|
||||
"navigationBarTitleText": "用户与隐私协议" |
|
||||
} |
|
||||
} |
|
||||
], |
|
||||
"globalStyle": { |
|
||||
"navigationBarTextStyle": "black", |
|
||||
"navigationBarTitleText": "uni-app", |
|
||||
"navigationBarBackgroundColor": "#F8F8F8", |
|
||||
"backgroundColor": "#F8F8F8", |
|
||||
"backgroundColorTop": "#FFFFFF" |
|
||||
}, |
|
||||
"tabBar": { |
|
||||
"color": "#888", |
|
||||
"selectedColor": "#007AFF", |
|
||||
"borderStyle": "white", |
|
||||
"backgroundColor": "#f9f9f9", |
|
||||
"list": [ |
|
||||
{ |
|
||||
"pagePath": "pages/client/index", |
|
||||
"iconPath": "static/imgs/tabbar/client-gray.png", |
|
||||
"selectedIconPath": "static/imgs/tabbar/client-blue.png", |
|
||||
"text": "客户" |
|
||||
}, |
|
||||
{ |
|
||||
"pagePath": "pages/trade/index", |
|
||||
"iconPath": "static/imgs/tabbar/trade-gray.png", |
|
||||
"selectedIconPath": "static/imgs/tabbar/trade-blue.png", |
|
||||
"text": "交易" |
|
||||
}, |
|
||||
{ |
|
||||
"pagePath": "pages/mall/index", |
|
||||
"iconPath": "static/imgs/tabbar/mall-gray.png", |
|
||||
"selectedIconPath": "static/imgs/tabbar/mall-blue.png", |
|
||||
"text": "纸商城" |
|
||||
}, |
|
||||
{ |
|
||||
"pagePath": "pages/mine/index", |
|
||||
"iconPath": "static/imgs/tabbar/mine-gray.png", |
|
||||
"selectedIconPath": "static/imgs/tabbar/mine-blue.png", |
|
||||
"text": "我的" |
|
||||
} |
|
||||
] |
|
||||
}, |
|
||||
"condition": { |
|
||||
//模式配置,仅开发期间生效 |
|
||||
"current": 0, //当前激活的模式(list 的索引项) |
|
||||
"list": [ |
|
||||
{ |
|
||||
"name": "", //模式名称 |
|
||||
"path": "", //启动页面,必选 |
|
||||
"query": "" //启动参数,在页面的onLoad函数里面得到 |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
|
"pages": [ |
||||
|
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages |
||||
|
|
||||
|
{ |
||||
|
"path": "pages/client/index", |
||||
|
"style": { |
||||
|
"navigationBarTitleText": "客户", |
||||
|
"navigationStyle": "custom" |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
"path": "pages/client-list/index", |
||||
|
"style": { |
||||
|
"navigationBarTitleText": "客户列表", |
||||
|
"navigationStyle": "custom" |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
"path": "pages/search/index", |
||||
|
"style": { |
||||
|
"navigationBarTitleText": "客户搜索", |
||||
|
"navigationStyle": "custom" |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
"path": "pages/add-user/index", |
||||
|
"style": { |
||||
|
"navigationBarTitleText": "添加客户", |
||||
|
"navigationStyle": "custom" |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
"path": "pages/trade/index", |
||||
|
"style": { |
||||
|
"navigationBarTitleText": "交易" |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
"path": "pages/mall/index", |
||||
|
"style": { |
||||
|
"navigationBarTitleText": "商城" |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
"path": "pages/mine/index", |
||||
|
"style": { |
||||
|
"navigationBarTitleText": "我的" |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
"path": "pages/login/index", |
||||
|
"style": { |
||||
|
"navigationBarTitleText": "登录", |
||||
|
"enablePullDownRefresh": false, |
||||
|
"navigationStyle": "custom" |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
"path": "pages/agreement/index", |
||||
|
"style": { |
||||
|
"navigationBarTitleText": "用户与隐私协议" |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
"path": "pages/client-detail/index", |
||||
|
"style": { |
||||
|
"navigationBarTitleText": "客户详情", |
||||
|
"navigationStyle": "custom" |
||||
|
} |
||||
|
} |
||||
|
,{ |
||||
|
"path" : "pages/client-detail/basic-information", |
||||
|
"style" : |
||||
|
{ |
||||
|
"navigationBarTitleText": "", |
||||
|
"enablePullDownRefresh": false |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
,{ |
||||
|
"path" : "pages/client-detail/equipment-information", |
||||
|
"style" : |
||||
|
{ |
||||
|
"navigationBarTitleText": "", |
||||
|
"enablePullDownRefresh": false |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
,{ |
||||
|
"path" : "pages/client-detail/base-paper-deals", |
||||
|
"style" : |
||||
|
{ |
||||
|
"navigationBarTitleText": "", |
||||
|
"enablePullDownRefresh": false |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
,{ |
||||
|
"path" : "pages/client-detail/waste-paper-trading", |
||||
|
"style" : |
||||
|
{ |
||||
|
"navigationBarTitleText": "", |
||||
|
"enablePullDownRefresh": false |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
,{ |
||||
|
"path" : "components/u-gap/u-gap", |
||||
|
"style" : |
||||
|
{ |
||||
|
"navigationBarTitleText": "", |
||||
|
"enablePullDownRefresh": false |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
], |
||||
|
"globalStyle": { |
||||
|
"navigationBarTextStyle": "black", |
||||
|
"navigationBarTitleText": "uni-app", |
||||
|
"navigationBarBackgroundColor": "#F8F8F8", |
||||
|
"backgroundColor": "#F8F8F8", |
||||
|
"backgroundColorTop": "#FFFFFF" |
||||
|
}, |
||||
|
"tabBar": { |
||||
|
"color": "#888", |
||||
|
"selectedColor": "#007AFF", |
||||
|
"borderStyle": "white", |
||||
|
"backgroundColor": "#f9f9f9", |
||||
|
"list": [{ |
||||
|
"pagePath": "pages/client/index", |
||||
|
"iconPath": "static/imgs/tabbar/client-gray.png", |
||||
|
"selectedIconPath": "static/imgs/tabbar/client-blue.png", |
||||
|
"text": "客户" |
||||
|
}, |
||||
|
{ |
||||
|
"pagePath": "pages/trade/index", |
||||
|
"iconPath": "static/imgs/tabbar/trade-gray.png", |
||||
|
"selectedIconPath": "static/imgs/tabbar/trade-blue.png", |
||||
|
"text": "交易" |
||||
|
}, |
||||
|
{ |
||||
|
"pagePath": "pages/mall/index", |
||||
|
"iconPath": "static/imgs/tabbar/mall-gray.png", |
||||
|
"selectedIconPath": "static/imgs/tabbar/mall-blue.png", |
||||
|
"text": "纸商城" |
||||
|
}, |
||||
|
{ |
||||
|
"pagePath": "pages/mine/index", |
||||
|
"iconPath": "static/imgs/tabbar/mine-gray.png", |
||||
|
"selectedIconPath": "static/imgs/tabbar/mine-blue.png", |
||||
|
"text": "我的" |
||||
|
} |
||||
|
] |
||||
|
}, |
||||
|
"condition": { |
||||
|
//模式配置,仅开发期间生效 |
||||
|
"current": 0, //当前激活的模式(list 的索引项) |
||||
|
"list": [{ |
||||
|
"name": "", //模式名称 |
||||
|
"path": "", //启动页面,必选 |
||||
|
"query": "" //启动参数,在页面的onLoad函数里面得到 |
||||
|
}] |
||||
|
} |
||||
} |
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
原纸交易 |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
|
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
|
||||
|
</style> |
||||
@ -0,0 +1,238 @@ |
|||||
|
<template> |
||||
|
<view class="warpper"> |
||||
|
<view class="card-box"> |
||||
|
<view class="card-header"> |
||||
|
<view class="left-text">基本信息</view> |
||||
|
<view class="right-text">跟进记录</view> |
||||
|
</view> |
||||
|
<view class="card-content"> |
||||
|
<view class="info"> |
||||
|
<image class="image" src="https://qncloud.oss-cn-shenzhen.aliyuncs.com/ztb_pic/testPic.jfif" |
||||
|
mode=""></image> |
||||
|
<view class="content"> |
||||
|
<view class="title"> |
||||
|
<text class="text">广州市金骏彩色印务有限公司</text> |
||||
|
<image class="icon" |
||||
|
:src="info.registrationStatus ? '/static/imgs/general/cooperation-icon.png' : '/static/imgs/general/no-cooperation-icon.png'"> |
||||
|
</image> |
||||
|
</view> |
||||
|
<view class="desc"> |
||||
|
<text>主营:生产画册、书刊、包装盒、手提袋子、手机钢化膜盒子、蛋糕盒等。</text> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="company-box"> |
||||
|
<view> |
||||
|
<view> |
||||
|
<text class="title">法定代表人</text> |
||||
|
</view> |
||||
|
<view class="value"> |
||||
|
曹孟德 |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class=""> |
||||
|
<view> |
||||
|
<text class="title">注册资本</text> |
||||
|
</view> |
||||
|
<view class="value"> |
||||
|
1727.2万 |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class=""> |
||||
|
<view> |
||||
|
<text class="title">成立时间</text> |
||||
|
</view> |
||||
|
<view class="value"> |
||||
|
2021/12/22 |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="site"> |
||||
|
<image class="icon" src="/static/imgs/client-list/navigation-icon.png"></image> |
||||
|
<text class="text">广东省广州市天河区车陂街道联合社区西区8栋8408</text> |
||||
|
</view> |
||||
|
</view> |
||||
|
<uGap></uGap> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import uGap from '@/components/u-gap/u-gap.vue' |
||||
|
export default { |
||||
|
components: { |
||||
|
uGap |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
info: { |
||||
|
"annualTurnover": 0, |
||||
|
"belongIndustry": "string", |
||||
|
"businessLicenseImg": "string", |
||||
|
"factoryAddress": "string", |
||||
|
"factoryImgList": [ |
||||
|
"string" |
||||
|
], |
||||
|
"foundDate": "2022-01-05T02:20:30.776Z", |
||||
|
"id": 0, |
||||
|
"leaseContract": "string", |
||||
|
"legalPersonName": "string", |
||||
|
"locCityId": 0, |
||||
|
"locCityName": "string", |
||||
|
"locDetail": "string", |
||||
|
"locDistriceName": "string", |
||||
|
"locDistrictId": 0, |
||||
|
"locProvinceId": 0, |
||||
|
"locProvinceName": "string", |
||||
|
"locStreetId": 0, |
||||
|
"locStreetName": "string", |
||||
|
"mainBusiness": "string", |
||||
|
"name": "string", |
||||
|
"plantArea": 0, |
||||
|
"registeredCapital": 0, |
||||
|
"registrationStatus": "string", |
||||
|
"shortName": "string", |
||||
|
"uniformSocialCreditCode": "string" |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
.warpper { |
||||
|
width: 750rpx; |
||||
|
height: 100%; |
||||
|
|
||||
|
.card-box { |
||||
|
.card-header { |
||||
|
display: flex; |
||||
|
flex-direction: row; |
||||
|
justify-content: space-between; |
||||
|
height: 88rpx; |
||||
|
line-height: 88rpx; |
||||
|
border-bottom: 2rpx solid #DDDDDD; |
||||
|
padding: 0rpx 32rpx; |
||||
|
|
||||
|
.left-text { |
||||
|
font-size: 30rpx; |
||||
|
color: #000000; |
||||
|
letter-spacing: 0; |
||||
|
font-weight: 600; |
||||
|
} |
||||
|
|
||||
|
.right-text { |
||||
|
font-size: 28rpx; |
||||
|
color: #007AFF; |
||||
|
letter-spacing: 0; |
||||
|
text-align: right; |
||||
|
font-weight: 400; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.card-content { |
||||
|
.info { |
||||
|
width: 750rpx; |
||||
|
display: flex; |
||||
|
flex-direction: row; |
||||
|
padding: 30rpx 32rpx 48rpx; |
||||
|
|
||||
|
.image { |
||||
|
width: 140rpx; |
||||
|
height: 140rpx; |
||||
|
flex: 0 0 140rpx; |
||||
|
margin-right: 20rpx; |
||||
|
} |
||||
|
|
||||
|
.content { |
||||
|
.title { |
||||
|
display: flex; |
||||
|
flex-direction: row; |
||||
|
align-items: center; |
||||
|
justify-content: flex-start; |
||||
|
|
||||
|
.text { |
||||
|
font-size: 32rpx; |
||||
|
color: #000000; |
||||
|
font-weight: 600; |
||||
|
} |
||||
|
|
||||
|
.icon { |
||||
|
width: 100rpx; |
||||
|
height: 32rpx; |
||||
|
flex-grow: 0; |
||||
|
flex-shrink: 0; |
||||
|
margin-left: 8rpx; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.desc { |
||||
|
margin-top: 14rpx; |
||||
|
font-size: 26rpx; |
||||
|
color: #333333; |
||||
|
line-height: 1.6; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.company-box { |
||||
|
display: flex; |
||||
|
flex-direction: row; |
||||
|
justify-content: space-around; |
||||
|
align-items: center; |
||||
|
text-align: center; |
||||
|
padding-bottom: 34rpx; |
||||
|
|
||||
|
.title { |
||||
|
font-size: 24rpx; |
||||
|
color: #888888; |
||||
|
letter-spacing: 0; |
||||
|
text-align: center; |
||||
|
font-weight: 400; |
||||
|
} |
||||
|
|
||||
|
.value { |
||||
|
font-size: 28rpx; |
||||
|
color: #333333; |
||||
|
letter-spacing: 0; |
||||
|
text-align: center; |
||||
|
padding-top: 16rpx; |
||||
|
font-weight: 500; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.site { |
||||
|
display: flex; |
||||
|
flex-direction: row; |
||||
|
align-items: center; |
||||
|
height: 80rpx; |
||||
|
line-height: 80rpx; |
||||
|
background: #FFFFFF; |
||||
|
border-top: 2rpx solid #DDDDDD; |
||||
|
padding: 0rpx 32rpx; |
||||
|
|
||||
|
.icon { |
||||
|
width: 32rpx; |
||||
|
height: 32rpx; |
||||
|
flex-grow: 0; |
||||
|
flex-shrink: 0; |
||||
|
margin-right: 10rpx; |
||||
|
} |
||||
|
|
||||
|
.text { |
||||
|
font-size: 26rpx; |
||||
|
color: #333333; |
||||
|
letter-spacing: 0; |
||||
|
text-align: left; |
||||
|
line-height: 32rpx; |
||||
|
font-weight: 400; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,45 @@ |
|||||
|
<template> |
||||
|
<view |
||||
|
class="header" |
||||
|
:style="{ |
||||
|
height: `${statusBarHeight + 44}px`, |
||||
|
paddingTop: `${statusBarHeight}px` |
||||
|
}" |
||||
|
> |
||||
|
<slot name="icon"> |
||||
|
<uni-icons type="back" size="28" @click="back" /> |
||||
|
</slot> |
||||
|
<slot> |
||||
|
</slot> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { back } from '@/utils/hook.js' |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
statusBarHeight: 20 |
||||
|
} |
||||
|
}, |
||||
|
mounted() { |
||||
|
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight - 0 |
||||
|
}, |
||||
|
methods: { |
||||
|
back |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
.header { |
||||
|
width: 750rpx; |
||||
|
padding: 0 32rpx 10rpx 20rpx; |
||||
|
background-color: #fff; |
||||
|
display: flex; |
||||
|
flex-direction: row; |
||||
|
align-items: center; |
||||
|
justify-content: space-between; |
||||
|
border-bottom: 2rpx solid #d8d8d8; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,22 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
设备信息 |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
|
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
|
||||
|
</style> |
||||
@ -0,0 +1,80 @@ |
|||||
|
<template> |
||||
|
<view class="warpper"> |
||||
|
<customHeader> |
||||
|
<view class="header-title"> |
||||
|
客户详情 |
||||
|
</view> |
||||
|
<view class="right-title"> |
||||
|
客户授信 |
||||
|
</view> |
||||
|
</customHeader> |
||||
|
<view> |
||||
|
<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="text" |
||||
|
activeColor="#007AFF"></uni-segmented-control> |
||||
|
<view class="content"> |
||||
|
<view v-show="current === 0"> |
||||
|
<basicInformation></basicInformation> |
||||
|
</view> |
||||
|
<view v-show="current === 1"> |
||||
|
<equipmentInformation></equipmentInformation> |
||||
|
</view> |
||||
|
<view v-show="current === 2"> |
||||
|
<basePaperDeals></basePaperDeals> |
||||
|
</view> |
||||
|
<view v-show="current === 3"> |
||||
|
<wastePaperTrading></wastePaperTrading> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import customHeader from './custom-header.vue' |
||||
|
import basicInformation from './basic-information.vue' |
||||
|
import equipmentInformation from './equipment-information.vue' |
||||
|
import basePaperDeals from './base-paper-deals.vue' |
||||
|
import wastePaperTrading from './waste-paper-trading.vue' |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
customHeader, |
||||
|
basicInformation, |
||||
|
equipmentInformation, |
||||
|
basePaperDeals, |
||||
|
wastePaperTrading |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
current: 0, |
||||
|
items: ['基础信息', '设备信息', '原纸交易', '废纸交易'] |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
onClickItem(e) { |
||||
|
console.log('e', e) |
||||
|
this.current = e.currentIndex |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
.warpper { |
||||
|
.header-title { |
||||
|
font-size: 36rpx; |
||||
|
color: #000000; |
||||
|
letter-spacing: 0; |
||||
|
text-align: center; |
||||
|
font-weight: 500; |
||||
|
} |
||||
|
|
||||
|
.right-title { |
||||
|
font-size: 28rpx; |
||||
|
color: #007AFF; |
||||
|
text-align: center; |
||||
|
line-height: 40rpx; |
||||
|
font-weight: 500; |
||||
|
} |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,464 @@ |
|||||
|
<template> |
||||
|
<view class="tabs"> |
||||
|
<view class="page"> |
||||
|
<!-- <swiper indicator-dots="true"> |
||||
|
<swiper-item v-for="(img, key) in imgUrls" :key="key"><image :src="img" /></swiper-item> |
||||
|
</swiper> --> |
||||
|
</view> |
||||
|
<scroll-view id="tab-bar" class="scroll-h" :scroll-x="true" :show-scrollbar="false" :scroll-into-view="scrollInto"> |
||||
|
<view v-for="(tab,index) in tabBars" :key="tab.id" class="uni-tab-item" :id="tab.id" :data-current="index" @click="ontabtap"> |
||||
|
<text class="uni-tab-item-title" :class="tabIndex==index ? 'uni-tab-item-title-active' : ''">{{tab.name}}</text> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
<view class="line-h"></view> |
||||
|
<swiper :current="tabIndex" class="swiper-box" style="flex: 1;" :duration="300" @change="ontabchange"> |
||||
|
<swiper-item class="swiper-item" v-for="(tab,index1) in newsList" :key="index1"> |
||||
|
<!-- #ifdef APP-NVUE --> |
||||
|
<list class="scroll-v list" enableBackToTop="true" scroll-y loadmoreoffset="15" @loadmore="loadMore(index1)"> |
||||
|
<refresh class="refresh" @refresh="onrefresh(index1)" @pullingdown="onpullingdown" :display="tab.refreshing ? 'show' : 'hide'"> |
||||
|
<div class="refresh-view"> |
||||
|
<image class="refresh-icon" :src="refreshIcon" :style="{width: (tab.refreshing || pulling) ? 0: '30px'}" :class="{'refresh-icon-active': tab.refreshFlag}"></image> |
||||
|
<loading-indicator class="loading-icon" animating="true" v-if="tab.refreshing"></loading-indicator> |
||||
|
<text class="loading-text">{{tab.refreshText}}</text> |
||||
|
</div> |
||||
|
</refresh> |
||||
|
<cell v-for="(newsitem,index2) in tab.data" :key="newsitem.id"> |
||||
|
<media-item :options="newsitem" @close="close(index1,index2)" @click="goDetail(newsitem)"></media-item> |
||||
|
</cell> |
||||
|
<cell class="loading-more" v-if="tab.isLoading || tab.data.length > 4"> |
||||
|
<text class="loading-more-text">{{tab.loadingText}}</text> |
||||
|
</cell> |
||||
|
</list> |
||||
|
<!-- #endif --> |
||||
|
<!-- #ifndef APP-NVUE --> |
||||
|
<scroll-view class="scroll-v list" enableBackToTop="true" scroll-y @scrolltolower="loadMore(index1)"> |
||||
|
<view v-for="(newsitem,index2) in tab.data" :key="newsitem.id"> |
||||
|
<media-item :options="newsitem" @close="close(index1,index2)" @click="goDetail(newsitem)"></media-item> |
||||
|
</view> |
||||
|
<view class="loading-more" v-if="tab.isLoading || tab.data.length > 4"> |
||||
|
<text class="loading-more-text">{{tab.loadingText}}</text> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
<!-- #endif --> |
||||
|
</swiper-item> |
||||
|
</swiper> |
||||
|
</view> |
||||
|
</template> |
||||
|
<script> |
||||
|
import mediaItem from './news-item.nvue'; |
||||
|
|
||||
|
// 缓存每页最多 |
||||
|
const MAX_CACHE_DATA = 100; |
||||
|
// 缓存页签数量 |
||||
|
const MAX_CACHE_PAGE = 3; |
||||
|
|
||||
|
const newsData = { |
||||
|
data0: { |
||||
|
"datetime": "40分钟前", |
||||
|
"article_type": 0, |
||||
|
"title": "uni-app行业峰会频频亮相,开发者反响热烈!", |
||||
|
"source": "DCloud", |
||||
|
"comment_count": 639 |
||||
|
}, |
||||
|
data1: { |
||||
|
"datetime": "一天前", |
||||
|
"article_type": 1, |
||||
|
"title": "DCloud完成B2轮融资,uni-app震撼发布!", |
||||
|
"image_url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b7c7f970-517d-11eb-97b7-0dc4655d6e68.jpg", |
||||
|
"source": "DCloud", |
||||
|
"comment_count": 11395 |
||||
|
}, |
||||
|
data2: { |
||||
|
"datetime": "一天前", |
||||
|
"article_type": 2, |
||||
|
"title": "中国技术界小奇迹:HBuilder开发者突破200万", |
||||
|
"image_url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b4cd3000-517d-11eb-a16f-5b3e54966275.jpg", |
||||
|
"source": "DCloud", |
||||
|
"comment_count": 11395 |
||||
|
}, |
||||
|
data3: { |
||||
|
"article_type": 3, |
||||
|
"image_list": [{ |
||||
|
"url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b2e201d0-517d-11eb-8a36-ebb87efcf8c0.jpg", |
||||
|
"width": 563, |
||||
|
"height": 316 |
||||
|
}, { |
||||
|
"url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b4cd3000-517d-11eb-a16f-5b3e54966275.jpg", |
||||
|
"width": 641, |
||||
|
"height": 360 |
||||
|
}, { |
||||
|
"url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b7c7f970-517d-11eb-97b7-0dc4655d6e68.jpg", |
||||
|
"width": 640, |
||||
|
"height": 360 |
||||
|
}], |
||||
|
"datetime": "5分钟前", |
||||
|
"title": "uni-app 支持使用 npm 安装第三方包,生态更趋丰富", |
||||
|
"source": "DCloud", |
||||
|
"comment_count": 11 |
||||
|
}, |
||||
|
data4: { |
||||
|
"datetime": "2小时前", |
||||
|
"article_type": 4, |
||||
|
"title": "uni-app 支持原生小程序自定义组件,更开放、更自由", |
||||
|
"image_url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b2e201d0-517d-11eb-8a36-ebb87efcf8c0.jpg", |
||||
|
"source": "DCloud", |
||||
|
"comment_count": 69 |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
mediaItem |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
showSwiper: true, |
||||
|
imgUrls: [ |
||||
|
'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b4b60b10-5168-11eb-bd01-97bc1429a9ff.jpg', |
||||
|
'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b1dcfa70-5168-11eb-bd01-97bc1429a9ff.jpg' |
||||
|
], |
||||
|
newsList: [], |
||||
|
cacheTab: [], |
||||
|
tabIndex: 0, |
||||
|
tabBars: [{ |
||||
|
name: '关注', |
||||
|
id: 'guanzhu' |
||||
|
}, { |
||||
|
name: '推荐', |
||||
|
id: 'tuijian' |
||||
|
}, { |
||||
|
name: '体育', |
||||
|
id: 'tiyu' |
||||
|
}, { |
||||
|
name: '热点', |
||||
|
id: 'redian' |
||||
|
}], |
||||
|
scrollInto: "", |
||||
|
showTips: false, |
||||
|
navigateFlag: false, |
||||
|
pulling: false, |
||||
|
refreshIcon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAB5QTFRFcHBw3Nzct7e39vb2ycnJioqK7e3tpqam29vb////D8oK7wAAAAp0Uk5T////////////ALLMLM8AAABxSURBVHja7JVBDoAgDASrjqj//7CJBi90iyYeOHTPMwmFZrHjYyyFYYUy1bwUZqtJIYVxhf1a6u0R7iUvWsCcrEtwJHp8MwMdvh2amHduiZD3rpWId9+BgPd7Cc2LIkPyqvlQvKxKBJ//Qwq/CacAAwDUv0a0YuKhzgAAAABJRU5ErkJggg==" |
||||
|
} |
||||
|
}, |
||||
|
/** |
||||
|
* 当 searchInput 配置 disabled 为 true 时触发 |
||||
|
*/ |
||||
|
onNavigationBarSearchInputClicked(e) { |
||||
|
console.log('事件执行了') |
||||
|
uni.navigateTo({ |
||||
|
url: '/pages/index/detail1/detail1' |
||||
|
}); |
||||
|
}, |
||||
|
/** |
||||
|
* 点击导航栏 buttons 时触发 |
||||
|
*/ |
||||
|
onNavigationBarButtonTap() { |
||||
|
uni.showModal({ |
||||
|
title: '提示', |
||||
|
content: '用户点击了功能按钮,这里仅做展示。', |
||||
|
success: res => { |
||||
|
if (res.confirm) { |
||||
|
console.log('用户点击了确定'); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
onLoad() { |
||||
|
setTimeout(()=>{ |
||||
|
this.tabBars.forEach((tabBar) => { |
||||
|
this.newsList.push({ |
||||
|
data: [], |
||||
|
isLoading: false, |
||||
|
refreshText: "", |
||||
|
loadingText: '加载更多...' |
||||
|
}); |
||||
|
}); |
||||
|
this.getList(0); |
||||
|
},350) |
||||
|
}, |
||||
|
methods: { |
||||
|
getList(index) { |
||||
|
let activeTab = this.newsList[index]; |
||||
|
let list = []; |
||||
|
for (let i = 1; i <= 10; i++) { |
||||
|
let item = Object.assign({}, newsData['data' + Math.floor(Math.random() * 5)]); |
||||
|
item.id = this.newGuid(); |
||||
|
list.push(item); |
||||
|
} |
||||
|
activeTab.data = activeTab.data.concat(list); |
||||
|
}, |
||||
|
goDetail(e) { |
||||
|
if (this.navigateFlag) { |
||||
|
return; |
||||
|
} |
||||
|
this.navigateFlag = true; |
||||
|
uni.navigateTo({ |
||||
|
url: './detail/detail?title=' + e.title |
||||
|
}); |
||||
|
setTimeout(() => { |
||||
|
this.navigateFlag = false; |
||||
|
}, 200) |
||||
|
}, |
||||
|
close(index1, index2) { |
||||
|
uni.showModal({ |
||||
|
content: '是否删除本条信息?', |
||||
|
success: (res) => { |
||||
|
if (res.confirm) { |
||||
|
this.newsList[index1].data.splice(index2, 1); |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
loadMore(e) { |
||||
|
setTimeout(() => { |
||||
|
this.getList(this.tabIndex); |
||||
|
}, 500) |
||||
|
}, |
||||
|
ontabtap(e) { |
||||
|
let index = e.target.dataset.current || e.currentTarget.dataset.current; |
||||
|
this.switchTab(index); |
||||
|
}, |
||||
|
ontabchange(e) { |
||||
|
let index = e.target.current || e.detail.current; |
||||
|
this.switchTab(index); |
||||
|
}, |
||||
|
switchTab(index) { |
||||
|
if (this.newsList[index].data.length === 0) { |
||||
|
this.getList(index); |
||||
|
} |
||||
|
|
||||
|
if (this.tabIndex === index) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
// 缓存 tabId |
||||
|
if (this.newsList[this.tabIndex].data.length > MAX_CACHE_DATA) { |
||||
|
let isExist = this.cacheTab.indexOf(this.tabIndex); |
||||
|
if (isExist < 0) { |
||||
|
this.cacheTab.push(this.tabIndex); |
||||
|
//console.log("cache index:: " + this.tabIndex); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
this.tabIndex = index; |
||||
|
this.scrollInto = this.tabBars[index].id; |
||||
|
|
||||
|
// 释放 tabId |
||||
|
if (this.cacheTab.length > MAX_CACHE_PAGE) { |
||||
|
let cacheIndex = this.cacheTab[0]; |
||||
|
this.clearTabData(cacheIndex); |
||||
|
this.cacheTab.splice(0, 1); |
||||
|
//console.log("remove cache index:: " + cacheIndex); |
||||
|
} |
||||
|
}, |
||||
|
clearTabData(e) { |
||||
|
this.newsList[e].data.length = 0; |
||||
|
this.newsList[e].loadingText = "加载更多..."; |
||||
|
}, |
||||
|
refreshData() {}, |
||||
|
onrefresh(e) { |
||||
|
var tab = this.newsList[this.tabIndex]; |
||||
|
if (!tab.refreshFlag) { |
||||
|
return; |
||||
|
} |
||||
|
tab.refreshing = true; |
||||
|
tab.refreshText = "正在刷新..."; |
||||
|
|
||||
|
setTimeout(() => { |
||||
|
this.refreshData(); |
||||
|
this.pulling = true; |
||||
|
tab.refreshing = false; |
||||
|
tab.refreshFlag = false; |
||||
|
tab.refreshText = "已刷新"; |
||||
|
setTimeout(() => { // TODO fix ios和Android 动画时间相反问题 |
||||
|
this.pulling = false; |
||||
|
}, 500); |
||||
|
}, 2000); |
||||
|
}, |
||||
|
onpullingdown(e) { |
||||
|
var tab = this.newsList[this.tabIndex]; |
||||
|
if (tab.refreshing || this.pulling) { |
||||
|
return; |
||||
|
} |
||||
|
if (Math.abs(e.pullingDistance) > Math.abs(e.viewHeight)) { |
||||
|
tab.refreshFlag = true; |
||||
|
tab.refreshText = "释放立即刷新"; |
||||
|
} else { |
||||
|
tab.refreshFlag = false; |
||||
|
tab.refreshText = "下拉可以刷新"; |
||||
|
} |
||||
|
}, |
||||
|
newGuid() { |
||||
|
let s4 = function() { |
||||
|
return (65536 * (1 + Math.random()) | 0).toString(16).substring(1); |
||||
|
} |
||||
|
return (s4() + s4() + "-" + s4() + "-4" + s4().substr(0, 3) + "-" + s4() + "-" + s4() + s4() + s4()).toUpperCase(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
image, |
||||
|
swiper, |
||||
|
.img-view { |
||||
|
width: 750rpx; |
||||
|
width: 100%; |
||||
|
height: 500rpx; |
||||
|
} |
||||
|
.page-section-title { |
||||
|
margin-top: 50rpx; |
||||
|
} |
||||
|
/* #ifndef APP-PLUS */ |
||||
|
page { |
||||
|
width: 100%; |
||||
|
min-height: 100%; |
||||
|
display: flex; |
||||
|
} |
||||
|
|
||||
|
/* #endif */ |
||||
|
|
||||
|
.tabs { |
||||
|
flex: 1; |
||||
|
flex-direction: column; |
||||
|
overflow: hidden; |
||||
|
background-color: #ffffff; |
||||
|
/* #ifndef APP-PLUS */ |
||||
|
height: 100vh; |
||||
|
/* #endif */ |
||||
|
} |
||||
|
|
||||
|
.scroll-h { |
||||
|
width: 750rpx; |
||||
|
/* #ifdef H5 */ |
||||
|
width:100%; |
||||
|
/* #endif */ |
||||
|
height: 80rpx; |
||||
|
flex-direction: row; |
||||
|
/* #ifndef APP-PLUS */ |
||||
|
white-space: nowrap; |
||||
|
/* #endif */ |
||||
|
/* flex-wrap: nowrap; */ |
||||
|
/* border-color: #cccccc; |
||||
|
border-bottom-style: solid; |
||||
|
border-bottom-width: 1px; */ |
||||
|
} |
||||
|
|
||||
|
.line-h { |
||||
|
height: 1rpx; |
||||
|
background-color: #cccccc; |
||||
|
} |
||||
|
|
||||
|
.uni-tab-item { |
||||
|
/* #ifndef APP-PLUS */ |
||||
|
display: inline-block; |
||||
|
/* #endif */ |
||||
|
flex-wrap: nowrap; |
||||
|
padding-left: 34rpx; |
||||
|
padding-right: 34rpx; |
||||
|
} |
||||
|
|
||||
|
.uni-tab-item-title { |
||||
|
color: #555; |
||||
|
font-size: 30rpx; |
||||
|
height: 80rpx; |
||||
|
line-height: 80rpx; |
||||
|
flex-wrap: nowrap; |
||||
|
/* #ifndef APP-PLUS */ |
||||
|
white-space: nowrap; |
||||
|
/* #endif */ |
||||
|
} |
||||
|
|
||||
|
.uni-tab-item-title-active { |
||||
|
color: #007AFF; |
||||
|
} |
||||
|
|
||||
|
.swiper-box { |
||||
|
flex: 1; |
||||
|
} |
||||
|
|
||||
|
.swiper-item { |
||||
|
flex: 1; |
||||
|
flex-direction: row; |
||||
|
} |
||||
|
|
||||
|
.scroll-v { |
||||
|
flex: 1; |
||||
|
/* #ifndef MP-ALIPAY */ |
||||
|
flex-direction: column; |
||||
|
/* #endif */ |
||||
|
width: 750rpx; |
||||
|
width:100%; |
||||
|
} |
||||
|
|
||||
|
.update-tips { |
||||
|
position: absolute; |
||||
|
left: 0; |
||||
|
top: 41px; |
||||
|
right: 0; |
||||
|
padding-top: 5px; |
||||
|
padding-bottom: 5px; |
||||
|
background-color: #FDDD9B; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
text-align: center; |
||||
|
} |
||||
|
|
||||
|
.update-tips-text { |
||||
|
font-size: 14px; |
||||
|
color: #ffffff; |
||||
|
} |
||||
|
|
||||
|
.refresh { |
||||
|
width: 750rpx; |
||||
|
width:100%; |
||||
|
height: 64px; |
||||
|
justify-content: center; |
||||
|
} |
||||
|
|
||||
|
.refresh-view { |
||||
|
flex-direction: row; |
||||
|
flex-wrap: nowrap; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
} |
||||
|
|
||||
|
.refresh-icon { |
||||
|
width: 30px; |
||||
|
height: 30px; |
||||
|
transition-duration: .5s; |
||||
|
transition-property: transform; |
||||
|
transform: rotate(0deg); |
||||
|
transform-origin: 15px 15px; |
||||
|
} |
||||
|
|
||||
|
.refresh-icon-active { |
||||
|
transform: rotate(180deg); |
||||
|
} |
||||
|
|
||||
|
.loading-icon { |
||||
|
width: 20px; |
||||
|
height: 20px; |
||||
|
margin-right: 5px; |
||||
|
color: #999999; |
||||
|
} |
||||
|
|
||||
|
.loading-text { |
||||
|
margin-left: 2px; |
||||
|
font-size: 16px; |
||||
|
color: #999999; |
||||
|
} |
||||
|
|
||||
|
.loading-more { |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
padding-top: 10px; |
||||
|
padding-bottom: 10px; |
||||
|
text-align: center; |
||||
|
} |
||||
|
|
||||
|
.loading-more-text { |
||||
|
font-size: 28rpx; |
||||
|
color: #999; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,22 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
废纸交易 |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
|
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
|
||||
|
</style> |
||||
@ -0,0 +1,9 @@ |
|||||
|
## 1.2.0(2021-11-19) |
||||
|
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) |
||||
|
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-segmented-control](https://uniapp.dcloud.io/component/uniui/uni-segmented-control) |
||||
|
## 1.1.0(2021-07-30) |
||||
|
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) |
||||
|
## 1.0.5(2021-05-12) |
||||
|
- 新增 项目示例地址 |
||||
|
## 1.0.4(2021-02-05) |
||||
|
- 调整为uni_modules目录规范 |
||||
@ -0,0 +1,146 @@ |
|||||
|
<template> |
||||
|
<view :class="[styleType === 'text'?'segmented-control--text' : 'segmented-control--button' ]" |
||||
|
:style="{ borderColor: styleType === 'text' ? '' : activeColor }" class="segmented-control"> |
||||
|
<view v-for="(item, index) in values" :class="[ styleType === 'text' ? '': 'segmented-control__item--button', |
||||
|
index === currentIndex&&styleType === 'button' ? 'segmented-control__item--button--active': '', |
||||
|
index === 0&&styleType === 'button' ? 'segmented-control__item--button--first': '', |
||||
|
index === values.length - 1&&styleType === 'button' ? 'segmented-control__item--button--last': '' ]" :key="index" |
||||
|
:style="{ backgroundColor: index === currentIndex && styleType === 'button' ? activeColor : '',borderColor: index === currentIndex&&styleType === 'text'||styleType === 'button'?activeColor:'transparent' }" |
||||
|
class="segmented-control__item" @click="_onClick(index)"> |
||||
|
<view> |
||||
|
<text :style="{color: |
||||
|
index === currentIndex |
||||
|
? styleType === 'text' |
||||
|
? activeColor |
||||
|
: '#fff' |
||||
|
: styleType === 'text' |
||||
|
? '#000' |
||||
|
: activeColor}" class="segmented-control__text" :class="styleType === 'text' && index === currentIndex ? 'segmented-control__item--text': ''">{{ item }}</text> |
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
/** |
||||
|
* SegmentedControl 分段器 |
||||
|
* @description 用作不同视图的显示 |
||||
|
* @tutorial https://ext.dcloud.net.cn/plugin?id=54 |
||||
|
* @property {Number} current 当前选中的tab索引值,从0计数 |
||||
|
* @property {String} styleType = [button|text] 分段器样式类型 |
||||
|
* @value button 按钮类型 |
||||
|
* @value text 文字类型 |
||||
|
* @property {String} activeColor 选中的标签背景色与边框颜色 |
||||
|
* @property {Array} values 选项数组 |
||||
|
* @event {Function} clickItem 组件触发点击事件时触发,e={currentIndex} |
||||
|
*/ |
||||
|
|
||||
|
export default { |
||||
|
name: 'UniSegmentedControl', |
||||
|
emits: ['clickItem'], |
||||
|
props: { |
||||
|
current: { |
||||
|
type: Number, |
||||
|
default: 0 |
||||
|
}, |
||||
|
values: { |
||||
|
type: Array, |
||||
|
default () { |
||||
|
return [] |
||||
|
} |
||||
|
}, |
||||
|
activeColor: { |
||||
|
type: String, |
||||
|
default: '#2979FF' |
||||
|
}, |
||||
|
styleType: { |
||||
|
type: String, |
||||
|
default: 'button' |
||||
|
} |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
currentIndex: 0 |
||||
|
} |
||||
|
}, |
||||
|
watch: { |
||||
|
current(val) { |
||||
|
if (val !== this.currentIndex) { |
||||
|
this.currentIndex = val |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
created() { |
||||
|
this.currentIndex = this.current |
||||
|
}, |
||||
|
methods: { |
||||
|
_onClick(index) { |
||||
|
if (this.currentIndex !== index) { |
||||
|
this.currentIndex = index |
||||
|
this.$emit('clickItem', { |
||||
|
currentIndex: index |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
.segmented-control { |
||||
|
/* #ifndef APP-NVUE */ |
||||
|
display: flex; |
||||
|
box-sizing: border-box; |
||||
|
/* #endif */ |
||||
|
flex-direction: row; |
||||
|
height: 36px; |
||||
|
overflow: hidden; |
||||
|
/* #ifdef H5 */ |
||||
|
cursor: pointer; |
||||
|
/* #endif */ |
||||
|
} |
||||
|
|
||||
|
.segmented-control__item { |
||||
|
/* #ifndef APP-NVUE */ |
||||
|
display: inline-flex; |
||||
|
box-sizing: border-box; |
||||
|
/* #endif */ |
||||
|
position: relative; |
||||
|
flex: 1; |
||||
|
justify-content: center; |
||||
|
align-items: center; |
||||
|
} |
||||
|
|
||||
|
.segmented-control__item--button { |
||||
|
border-style: solid; |
||||
|
border-top-width: 1px; |
||||
|
border-bottom-width: 1px; |
||||
|
border-right-width: 1px; |
||||
|
border-left-width: 0; |
||||
|
} |
||||
|
|
||||
|
.segmented-control__item--button--first { |
||||
|
border-left-width: 1px; |
||||
|
border-top-left-radius: 5px; |
||||
|
border-bottom-left-radius: 5px; |
||||
|
} |
||||
|
|
||||
|
.segmented-control__item--button--last { |
||||
|
border-top-right-radius: 5px; |
||||
|
border-bottom-right-radius: 5px; |
||||
|
} |
||||
|
|
||||
|
.segmented-control__item--text { |
||||
|
border-bottom-style: solid; |
||||
|
border-bottom-width: 2px; |
||||
|
padding: 6px 0; |
||||
|
} |
||||
|
|
||||
|
.segmented-control__text { |
||||
|
font-size: 14px; |
||||
|
line-height: 20px; |
||||
|
text-align: center; |
||||
|
font-weight: 500; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,87 @@ |
|||||
|
{ |
||||
|
"id": "uni-segmented-control", |
||||
|
"displayName": "uni-segmented-control 分段器", |
||||
|
"version": "1.2.0", |
||||
|
"description": "分段器由至少 2 个分段控件组成,用作不同视图的显示", |
||||
|
"keywords": [ |
||||
|
"uni-ui", |
||||
|
"uniui", |
||||
|
"分段器", |
||||
|
"segement", |
||||
|
"顶部选择" |
||||
|
], |
||||
|
"repository": "https://github.com/dcloudio/uni-ui", |
||||
|
"engines": { |
||||
|
"HBuilderX": "" |
||||
|
}, |
||||
|
"directories": { |
||||
|
"example": "../../temps/example_temps" |
||||
|
}, |
||||
|
"dcloudext": { |
||||
|
"category": [ |
||||
|
"前端组件", |
||||
|
"通用组件" |
||||
|
], |
||||
|
"sale": { |
||||
|
"regular": { |
||||
|
"price": "0.00" |
||||
|
}, |
||||
|
"sourcecode": { |
||||
|
"price": "0.00" |
||||
|
} |
||||
|
}, |
||||
|
"contact": { |
||||
|
"qq": "" |
||||
|
}, |
||||
|
"declaration": { |
||||
|
"ads": "无", |
||||
|
"data": "无", |
||||
|
"permissions": "无" |
||||
|
}, |
||||
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" |
||||
|
}, |
||||
|
"uni_modules": { |
||||
|
"dependencies": ["uni-scss"], |
||||
|
"encrypt": [], |
||||
|
"platforms": { |
||||
|
"cloud": { |
||||
|
"tcb": "y", |
||||
|
"aliyun": "y" |
||||
|
}, |
||||
|
"client": { |
||||
|
"App": { |
||||
|
"app-vue": "y", |
||||
|
"app-nvue": "y" |
||||
|
}, |
||||
|
"H5-mobile": { |
||||
|
"Safari": "y", |
||||
|
"Android Browser": "y", |
||||
|
"微信浏览器(Android)": "y", |
||||
|
"QQ浏览器(Android)": "y" |
||||
|
}, |
||||
|
"H5-pc": { |
||||
|
"Chrome": "y", |
||||
|
"IE": "y", |
||||
|
"Edge": "y", |
||||
|
"Firefox": "y", |
||||
|
"Safari": "y" |
||||
|
}, |
||||
|
"小程序": { |
||||
|
"微信": "y", |
||||
|
"阿里": "y", |
||||
|
"百度": "y", |
||||
|
"字节跳动": "y", |
||||
|
"QQ": "y" |
||||
|
}, |
||||
|
"快应用": { |
||||
|
"华为": "u", |
||||
|
"联盟": "u" |
||||
|
}, |
||||
|
"Vue": { |
||||
|
"vue2": "y", |
||||
|
"vue3": "y" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
|
||||
|
|
||||
|
## SegmentedControl 分段器 |
||||
|
> **组件名:uni-segmented-control** |
||||
|
> 代码块: `uSegmentedControl` |
||||
|
|
||||
|
|
||||
|
用作不同视图的显示 |
||||
|
|
||||
|
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-segmented-control) |
||||
|
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 |
||||
|
|
||||
|
|
||||
Write
Preview
Loading…
Cancel
Save