Commit 4168a710 authored by TtTao's avatar TtTao

初始化:cli项目

parent 01ed14f5
...@@ -108,7 +108,7 @@ export default { ...@@ -108,7 +108,7 @@ export default {
type: String, type: String,
default: 'none' default: 'none'
}, },
//top rpx 选择框高度也用这个值 //rpx 选择框高度也用这个值
top: { top: {
type: Number, type: Number,
default: 90 default: 90
......
...@@ -525,7 +525,7 @@ ...@@ -525,7 +525,7 @@
style += '</style>'; style += '</style>';
html = style + html; html = style + html;
} }
// 处理 rpx // 处理rpx
if (html.includes('rpx')) if (html.includes('rpx'))
html = html.replace(/[0-9.]+\s*rpx/g, $ => (parseFloat($) * windowWidth / 750) + 'px'); html = html.replace(/[0-9.]+\s*rpx/g, $ => (parseFloat($) * windowWidth / 750) + 'px');
return html; return html;
......
...@@ -17,135 +17,135 @@ ...@@ -17,135 +17,135 @@
color: subColor color: subColor
}" @tap="rightClick"> }" @tap="rightClick">
{{subTitle}} {{subTitle}}
<view class="u-section__right-info__icon-arrow u-flex"> <view class="u-section__right-info__icon-arrow u-flex" v-if="arrow">
<u-icon v-if="arrow" name="arrow-right" size="24" :color="subColor"></u-icon> <u-icon name="arrow-right" size="24" :color="subColor"></u-icon>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
/** /**
* section 查看更多 * section 查看更多
* @description 该组件一般用于分类信息有很多,但是限于篇幅只能列出一部分,让用户通过"查看更多"获得更多信息的场景,实际效果见演示。 * @description 该组件一般用于分类信息有很多,但是限于篇幅只能列出一部分,让用户通过"查看更多"获得更多信息的场景,实际效果见演示。
* @tutorial https://www.uviewui.com/components/section.html * @tutorial https://www.uviewui.com/components/section.html
* @property {String} title 左边主标题 * @property {String} title 左边主标题
* @property {String} sub-title 右边副标题(默认更多) * @property {String} sub-title 右边副标题(默认更多)
* @property {Boolean} right 是否显示右边的内容(默认true) * @property {Boolean} right 是否显示右边的内容(默认true)
* @property {Boolean} showLine 是否显示左边的竖条(默认true) * @property {Boolean} arrow 是否显示右边箭头(默认true)
* @property {String Number} font-size 主标题的字体大小(默认28) * @property {Boolean} showLine 是否显示左边的竖条(默认true)
* @property {Boolean} bold 主标题是否加粗(默认true) * @property {String Number} font-size 主标题的字体大小(默认28)
* @property {String} color 主标题颜色(默认#303133) * @property {Boolean} bold 主标题是否加粗(默认true)
* @property {Boolean} arrow 是否显示右侧箭头(默认true) * @property {String} color 主标题颜色(默认#303133)
* @event {Function} click 组件右侧的内容被点击时触发,用于跳转"更多" * @event {Function} click 组件右侧的内容被点击时触发,用于跳转"更多"
* @example <u-section title="今日热门" :right="false"></u-section> * @example <u-section title="今日热门" :right="false"></u-section>
*/ */
export default { export default {
name: "u-section", name: "u-section",
props: { props: {
// 标题信息 // 标题信息
title: { title: {
type: String, type: String,
default: '' default: ''
},
// 右边副标题内容
subTitle: {
type: String,
default: '更多'
},
// 是否显示右边的内容
right: {
type: Boolean,
default: true
},
fontSize: {
type: [Number, String],
default: 28
},
// 主标题是否加粗
bold: {
type: Boolean,
default: true
},
// 主标题的颜色
color: {
type: String,
default: '#303133'
},
// 右边副标题的颜色
subColor: {
type: String,
default: '#909399'
},
// 是否显示左边的竖条
showLine: {
type: Boolean,
default: true
},
// 左边竖线的颜色
lineColor: {
type: String,
default: ''
},
// 是否显示右侧箭头
arrow: {
type: Boolean,
default: true
}
}, },
computed: { // 右边副标题内容
// 左边竖条的样式 subTitle: {
lineStyle() { type: String,
// 由于安卓和iOS的,需要稍微调整绝对定位的top值,才能让左边的竖线和右边的文字垂直居中 default: '更多'
return { },
// 由于竖线为字体图标,具有比实际线宽更宽的宽度,所以也需要根据字体打下动态调整 // 是否显示右边的内容
left: -(Number(this.fontSize) * 0.9) + 'rpx', right: {
top: -(Number(this.fontSize) * (this.$u.os == 'ios' ? 0.14 : 0.15)) + 'rpx', type: Boolean,
} default: true
} },
fontSize: {
type: [Number, String],
default: 28
},
// 主标题是否加粗
bold: {
type: Boolean,
default: true
},
// 主标题的颜色
color: {
type: String,
default: '#303133'
},
// 右边副标题的颜色
subColor: {
type: String,
default: '#909399'
},
// 是否显示左边的竖条
showLine: {
type: Boolean,
default: true
},
// 左边竖线的颜色
lineColor: {
type: String,
default: ''
},
// 是否显示右边箭头
arrow: {
type: Boolean,
default: true
}, },
methods: { },
rightClick() { computed: {
this.$emit('click'); // 左边竖条的样式
lineStyle() {
// 由于安卓和iOS的,需要稍微调整绝对定位的top值,才能让左边的竖线和右边的文字垂直居中
return {
// 由于竖线为字体图标,具有比实际线宽更宽的宽度,所以也需要根据字体打下动态调整
left: -(Number(this.fontSize) * 0.9) + 'rpx',
top: -(Number(this.fontSize) * (this.$u.os == 'ios' ? 0.14 : 0.15)) + 'rpx',
} }
} }
},
methods: {
rightClick() {
this.$emit('click');
}
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "../../libs/css/style.components.scss"; @import "../../libs/css/style.components.scss";
.u-section {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
.u-section { &__title {
position: relative;
font-size: 28rpx;
padding-left: 20rpx;
display: flex; display: flex;
justify-content: space-between;
align-items: center; align-items: center;
width: 100%;
&__title {
position: relative;
font-size: 28rpx;
padding-left: 20rpx;
display: flex;
align-items: center;
&__icon-wrap { &__icon-wrap {
position: absolute; position: absolute;
} }
&__text { &__text {
line-height: 1; line-height: 1;
}
} }
}
&__right-info { &__right-info {
color: $u-tips-color; color: $u-tips-color;
font-size: 26rpx; font-size: 26rpx;
display: flex; display: flex;
align-items: center; align-items: center;
&__icon-arrow { &__icon-arrow {
margin-left: 6rpx; margin-left: 6rpx;
}
} }
} }
}
</style> </style>
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