修复http请求头某些情况下可能无效的问题

修正toast组件的position参数拼写错误的问题
给empty组件添加margin-top参数
改进rate组件的示例效果
将collapse的标题按压效果设置为自定义可选形式
优化tabs组件标签的居中问题
优化grid宫格组件的hover-class按下效果
新增uView特色的基础样式类,涵盖内外边距,字体大小,颜色,flex布局等
parent 63471554
......@@ -25,5 +25,4 @@
background: transparent;
}
/* #endif */
</style>
......@@ -21,7 +21,7 @@
</view>
<view class="u-config-item">
<view class="u-item-title">位置</view>
<u-subsection vibrateShort current="1" :list="['顶部', '中部', '底部']" @change="postionChange"></u-subsection>
<u-subsection vibrateShort current="1" :list="['顶部', '中部', '底部']" @change="positionChange"></u-subsection>
</view>
<view class="u-config-item">
<view class="u-item-title">显示图标</view>
......@@ -38,7 +38,7 @@
type: 'success',
title: '桃花潭水深千尺',
icon: true,
postion: 'center',
position: 'center',
url: '',
}
},
......@@ -47,8 +47,8 @@
this.type = index == 0 ? 'primary' : index == 1 ? 'success' : index == 2 ? 'error' : index == 3 ? 'warning' : 'default';
this.show();
},
postionChange(index) {
this.postion = index == 0 ? 'top' : index == 1 ? 'center' : 'bottom';
positionChange(index) {
this.position = index == 0 ? 'top' : index == 1 ? 'center' : 'bottom';
this.show();
},
iconChange(index) {
......@@ -62,7 +62,7 @@
show() {
this.$refs.uToast.show({
title: this.title,
postion: this.postion,
position: this.position,
type: this.type,
icon: this.icon,
url: this.url,
......
......@@ -50,8 +50,18 @@
inactiveColor: '#b2b2b2',
disabled: false,
count: 5,
activeIcon: 'star-fill',
inactiveIcon: 'star'
customIcon: false,
plain: false,
}
},
computed: {
activeIcon() {
let icon = this.customIcon ? 'heart' : 'star';
return this.plain ? icon : icon + '-fill'
},
inactiveIcon() {
let icon = this.customIcon ? 'heart' : 'star';
return this.plain ? icon : icon + '-fill'
}
},
methods: {
......@@ -59,12 +69,7 @@
this.current = index == 0 ? 1 : index == 1 ? 2 : index == 2 ? 3 : 4;
},
plainChange(index) {
// 这里只是为了演示镂空状态,实际使用中不会发生这种情况,请求纠结这里的写法
if(index == 0) {
this.activeIcon = this.activeIcon == 'star-fill' ? 'star' : 'heart';
} else {
this.activeIcon = this.activeIcon == 'star' ? 'star-fill' : 'heart-fill';
}
this.plain = !index;
},
disabledChange(index) {
this.disabled = index == 0 ? true : false;
......@@ -82,13 +87,7 @@
}
},
iconChange(index) {
if(index == 0) {
this.activeIcon = 'heart-fill';
this.inactiveIcon = 'heart';
} else {
this.activeIcon = 'star-fill';
this.inactiveIcon = 'star';
}
this.customIcon = !index;
},
change(val) {
// console.log(val);
......
......@@ -6,7 +6,9 @@
<u-toast ref="uToast"></u-toast>
<u-collapse event-type="close" :arrow="arrow" :accordion="accordion" @change="change">
<u-collapse-item :index="index" @change="itemChange" :title="item.head" v-for="(item, index) in itemList" :key="index">
<view class="">
{{item.body}}
</view>
</u-collapse-item>
</u-collapse>
</view>
......@@ -54,6 +56,7 @@
}],
accordion: true,
arrow: true,
hoverClass: 'hover2'
}
},
methods: {
......@@ -85,6 +88,12 @@
}
</script>
<style>
.hover1 {
background-color: red;
}
</style>
<style lang="scss" scoped>
.wrap {
// padding: 24rpx;
......
<template>
<view>
<view style="margin: 20px 0px 20px 0px;">
<scroll-view scroll-x enable-flex class="scroll">
<view v-for="i in 4" :key="i" class="slider">
<view class="slider-view-1">
<view class="slider-view-1-1">推广奖励</view>
<view class="slider-view-1-2">
<u-count-to color="#fff" font-size="80" :end-val="500"></u-count-to>
</view>
</view>
<view class="slider-view-2">
下次是手动阿萨德撒的撒的
下次是手动阿萨德撒的撒的
下次是手动阿萨德撒的撒的
下次是手动阿萨德撒的撒的
下次是手动阿萨德撒的撒的
下次是手动阿萨德撒的撒的
下次是手动阿萨德撒的撒的
下次是手动阿萨德撒的撒的
下次是手动阿萨德撒的撒的
下次是手动阿萨德撒的撒的
</view>
</view>
</scroll-view>
<view class="content">
<text class="content-title" >推广奖励怎么计算?</text>
<view class="content-view">
<view>
<u-button type="error"
size="medium"
@tap="to('/pages/center/agent/agentplus')">
进入代理管理后台
</u-button>
<u-button :ripple="true" @tap="to('/pages/center/agent/agentlist')" type="error" size="medium">查看详细奖励记录</u-button>
</view>
</view>
</view>
</view>
<view class="wrap u-flex">
</view>
</template>
<script>
export default {
data() {
return {
customStyle:{
}
}
},
methods: {
to(e){
uni.navigateTo({
url: e
});
}
onLoad() {
getApp().globalData.username = 'test12';
}
}
</script>
<style scoped>
/deep/.uni-scroll-view::-webkit-scrollbar {
display: none
}
.scroll{
white-space: nowrap;
width: 100%;
overflow: hidden;
display: flex;
}
.slider{
display: inline-block;
width: 200px;
height: 230px;
background-color: red;
background-color: #fff;
margin: 0 20px 0 20px;
box-shadow:15px 0 15px -15px #606266,
-15px 0 15px -15px #606266;
}
.slider-view-1{
height: 70%;
background-color: #007AFF;
position: relative;
display: flex;
padding: 5px;
}
.slider-view-2{
height: 30%;
background-color: #fff;
white-space:normal;
overflow-y: auto;
padding: 5px;
font-size: 12px;
color: #909399;
}
.slider-view-1-1{
color:#fff;
font-size: 14px;
<style lang="scss" scoped>
}
.slider-view-1-2{
color:#fff;
font-size: 14px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
.content{
margin: 20px 5px 20px 5px;
padding: 10px;
background: #fff;
}
.content-title{
font-size: 16px;
color: #007AFF;
font-weight: bold;
}
.content-view{
margin: 10px;
display: flex;
border-bottom: 1px solid #c8c9cc;
padding-bottom: 10px;
font-size: 14px;
}
</style>
......@@ -4,6 +4,3 @@
* uView自定义的css类名和scss变量,均以"u-"开头,不会造成冲突,请放心使用
*/
@import '@/uview/index.scss';
$u-type-success: black;
\ No newline at end of file
<template>
<view class="u-collapse-item">
<view class="u-collapse-head" @tap.stop="headClick" hover-class="u-hover-class" :style="[headStyle]">
<view :hover-stay-time="200" class="u-collapse-head" @tap.stop="headClick" :hover-class="hoverClass" :style="[headStyle]">
<view class="u-collapse-title u-line-1" :style="[{ textAlign: align ? align : 'left' },
isShow && activeStyle && !arrow ? activeStyle : '']">
{{ title }}
......@@ -84,7 +84,8 @@
height: 0, // body内容的高度
headStyle: {}, // 头部样式,对象形式
bodyStyle: {}, // 主体部分样式
arrowColor: ''
arrowColor: '',
hoverClass: '', // 头部按下时的效果样式类
};
},
mounted() {
......@@ -100,7 +101,7 @@
computed: {
arrow() {
return this.uCollapse.arrow;
}
},
},
created() {
this.isShow = this.open;
......@@ -109,6 +110,7 @@
this.headStyle = this.uCollapse.headStyle;
this.bodyStyle = this.uCollapse.bodyStyle;
this.arrowColor = this.uCollapse.arrowColor;
this.hoverClass = this.uCollapse.hoverClass;
},
methods: {
// 点击collapsehead头部
......
......@@ -14,6 +14,7 @@
* @property {String} arrow-color 标题右侧箭头的颜色(默认#909399)
* @property {String} head-bg-color 标题的背景颜色(默认#ffffff)
* @property {String} body-bg-color 主体内容的背景颜色(默认#ffffff)
* @property {String} hover-class 样式类名,按下时有效(默认u-hover-class)
* @event {Function} change 当前激活面板展开时触发(如果是手风琴模式,参数activeNames类型为String,否则为Array)
* @example <u-collapse></u-collapse>
*/
......@@ -49,6 +50,11 @@
type: String,
default: ''
},
// 标题部分按压时的样式类,"none"为无效果
hoverClass: {
type: String,
default: 'u-hover-class'
}
},
provide() {
return {
......
<template>
<view class="u-empty" v-if="show">
<view class="u-empty" v-if="show" :style="{
marginTop: marginTop + 'rpx'
}">
<image class="u-image" :src="src ? src : icons[mode].image" mode="widthFix" :style="{
width: imgWidth + 'rpx',
height: imgHeight == 'auto' ? 'auto' : imgHeight + 'rpx'
......@@ -29,6 +31,7 @@
* @property {String} mode 内置的图标,见官网说明(默认data)
* @property {String Number} img-width 图标的宽度,单位rpx(默认240)
* @property {String} img-height 图标的高度,单位rpx(默认auto)
* @property {String Number} margin-top 组件距离上一个元素之间的距离(默认0)
* @property {Boolean} show 是否显示组件(默认true)
* @event {Function} click 点击组件时触发
* @event {Function} close 点击关闭按钮时触发
......@@ -76,6 +79,11 @@
show: {
type: Boolean,
default: true
},
// 组件距离上一个元素之间的距离
marginTop: {
type: [String, Number],
default: 0
}
},
data() {
......
<template>
<view class="u-grid-item" :class="[showBorder ? 'u-border-right u-border-bottom' : '']" :hover-class="hoverClass ? 'u-grid-item-hover' : ''"
<view class="u-grid-item" :class="[showBorder ? 'u-border-right u-border-bottom' : '']" :hover-class="hoverClass"
:hover-stay-time="200" @tap="click" :style="{
background: bgColor,
width: width + 'px'
......
......@@ -26,15 +26,15 @@ export default {
type: Boolean,
default: true
},
// 是否显示hover-class的样式
hoverClass: {
type: Boolean,
default: false
},
// 宫格对齐方式,表现为数量少的时候,靠左,居中,还是靠右
align: {
type: String,
default: 'left'
},
// 宫格按压时的样式类,"none"为无效果
hoverClass: {
type: String,
default: 'u-hover-class'
}
},
data() {
......
......@@ -3,7 +3,10 @@
<view class="u-content" :style="{ height: isLongContent && !showMore ? showHeight + 'px' : 'auto' }">
<slot></slot>
</view>
<view @tap="toggleReadMore" v-if="isLongContent" class="u-showmore-wrap" :class="{ 'u-show-more': showMore }">
<view @tap="toggleReadMore" v-if="isLongContent" class="u-showmore-wrap"
:class="{ 'u-show-more': showMore }"
:style="[shadowStyle]"
>
<text class="u-readmore-btn" :style="{
fontSize: fontSize + 'rpx',
color: color
......@@ -60,6 +63,17 @@
fontSize: {
type: [String, Number],
default: 28
},
// 是否显示阴影
shadowStyle: {
type: Object,
default() {
return {
backgroundImage: "linear-gradient(-180deg, rgba(255, 255, 255, 0) 0%, #fff 80%)",
paddingTop: "300rpx",
marginTop: "-300rpx"
}
}
}
},
watch: {
......@@ -120,9 +134,6 @@
.u-showmore-wrap {
position: relative;
width: 100%;
background-image: linear-gradient(-180deg, rgba(255, 255, 255, 0) 0%, #fff 80%);
padding-top: 300rpx;
margin-top: -300rpx;
padding-bottom: 26rpx;
display: flex;
align-items: center;
......
<template>
<view class="u-toast" :class="[isShow ? 'u-show' : '', 'u-type-' + config.type, 'u-postion-' + config.postion]" :style="{
<view class="u-toast" :class="[isShow ? 'u-show' : '', 'u-type-' + config.type, 'u-position-' + config.position]" :style="{
padding: isShow ? '0 40rpx' : 0,
zIndex: uZIndex
}">
......@@ -40,7 +40,7 @@
isTab: false, // 是否跳转tab页面
url: '', // toast消失后是否跳转页面,有则跳转
icon: true, // 显示的图标
postion: 'center', // toast出现的位置
position: 'center', // toast出现的位置
}
};
},
......@@ -156,19 +156,19 @@
line-height: normal;
}
.u-postion-center {
.u-position-center {
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
}
.u-postion-top {
.u-position-top {
left: 50%;
top: 20%;
transform: translateX(-50%) translateY(-50%);
}
.u-postion-bottom {
.u-position-bottom {
left: 50%;
bottom: 20%;
transform: translateX(-50%) translateY(-50%);
......
......@@ -61,7 +61,8 @@ u-icon {
/* start--hover-class-start */
.u-hover-class {
background-color: #f7f8f9!important;
// background-color: #f7f8f9!important;
opacity: 0.6;
}
/* end--hover-class--end */
......
// 此版本发布于2020-04-27
let version = '1.1.2';
// 此版本发布于2020-04-28
let version = '1.1.3';
export default {
v: version,
......
.u-font-xs {
font-size: 22rpx;
}
.u-font-sm {
font-size: 26rpx;
}
.u-font-md {
font-size: 28rpx;
}
.u-font-lg {
font-size: 30rpx;
}
.u-font-xl {
font-size: 34rpx;
}
.u-flex {
display: flex;
flex-wrap: wrap;
......@@ -79,9 +99,20 @@
}
}
// 定义外边距
// 定义外边距
@for $i from 1 through 80 {
@if $i % 2 == 0 or $i % 5 == 0 {
// 得出:u-margin-30或者u-m-30
.u-margin-#{$i}, .u-m-#{$i} {
margin: $i + rpx;
}
// 得出:u-padding-30或者u-p-30
.u-padding-#{$i}, .u-p-#{$i} {
padding: $i + rpx;
}
// 完整版,结果如:u-margin-left-30
@each $dirction in left, top, right, botttom {
// 定义外边距
.u-margin-#{$dirction}-#{$i} {
......@@ -93,6 +124,19 @@
padding: $i + rpx;
}
}
// 缩写版,结果如: u-m-l-30
@each $dirction in l, t, r, b {
// 定义外边距
.u-m-#{$dirction}-#{$i} {
margin: $i + rpx;
}
// 定义内边距
.u-p-#{$dirction}-#{$i} {
padding: $i + rpx;
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment