| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <template>
- <view class="m-title-box">
- <text class="m-title" :style="getTitleStyle">{{title}}</text>
- <view class="m-title-end-box" @click="commit">
- <text class="m-subTitle" :style="getSubTitleStyle">{{subTitle}}</text>
- <image v-show="showRow" class="m-title-row" src="/static/ic_login_right_row.svg" mode="widthFix">
- </image>
- </view>
- </view>
- </template>
- <script>
- export default {
- // 通用title
- name: "m-title",
- props: {
- color: {
- type: String,
- default: "#333333"
- },
- fontWeight: {
- type: String,
- default: "500"
- },
- height: {
- type: String,
- default: "auto"
- },
- titleSize: {
- type: String,
- default: "28rpx"
- },
- subTitleSize: {
- type: String,
- default: "28rpx"
- },
- title: {
- type: String,
- default: ""
- },
- subTitle: {
- type: String,
- default: ""
- },
- showRow: {
- type: Boolean,
- default: true
- },
- },
- computed: {
- getTitleStyle() {
- return "height:" + this.height + ";color:" + this.color + ";font-weight:" + this.fontWeight +
- ";font-size:" + this.titleSize + ";"
- },
- getSubTitleStyle() {
- return "font-size:" + this.subTitleSize + ";"
- },
- },
- data() {
- return {
- };
- },
- methods: {
- commit(index) {
- this.$emit("click", index)
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .m-title-box {
- width: 100%;
- height: 100%;
- display: flex;
- flex-direction: row;
- align-items: center;
- }
- .m-title {
- font-family: 'PingFang SC';
- font-style: normal;
- line-height: 20px;
- display: flex;
- align-items: center;
- text-align: center;
- letter-spacing: 0.02em;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .m-title-end-box {
- flex: 1;
- height: 100%;
- display: flex;
- align-items: center;
- flex-direction: row;
- justify-content: flex-end;
- }
- .m-subTitle {
- font-family: 'PingFang SC';
- font-style: normal;
- font-weight: 400;
- text-align: right;
- letter-spacing: 0.02em;
- color: #999999;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .m-title-row {
- width: 32rpx;
- height: 32rpx;
- }
- </style>
|