Parcourir la source

新增:页面设计标题文本组件

萤火科技 il y a 1 an
Parent
commit
0c9514b39b
2 fichiers modifiés avec 88 ajouts et 1 suppressions
  1. 81 0
      components/page/diyComponents/title/index.vue
  2. 7 1
      components/page/index.vue

+ 81 - 0
components/page/diyComponents/title/index.vue

@@ -0,0 +1,81 @@
+<template>
+  <!-- 标题文本 -->
+  <view class="diy-title" :style="{ padding: `${itemStyle.paddingY * 2}rpx 30rpx`, background: itemStyle.background }">
+    <div class="title-content">
+      <!-- 标题文字 -->
+      <div class="title">
+        <text
+          :style="{ color: itemStyle.titleTextColor, fontSize: `${params.titleFontSize * 2}rpx`, fontWeight: params.titleFontWeight }">{{ params.title }}</text>
+      </div>
+      <!-- 查看更多 -->
+      <div v-if="params.more.enable" class="more-content" :style="{ color: itemStyle.moreTextColor }" @click="onLink(params.more.link)">
+        <text class="more-text">{{ params.more.text }}</text>
+        <text v-if="params.more.enableIcon" class="more-icon">
+          <text class="iconfont icon-arrow-right"></text>
+        </text>
+      </div>
+    </div>
+    <!-- 描述文字 -->
+    <div class="desc-content">
+      <text
+        :style="{ color: itemStyle.descTextColor, fontSize: `${params.descFontSize * 2}rpx`, fontWeight: params.descFontWeight }">{{ params.desc }}</text>
+    </div>
+  </view>
+</template>
+
+<script>
+  import mixin from '../mixin'
+
+  export default {
+
+    /**
+     * 组件的属性列表
+     * 用于组件自定义设置
+     */
+    props: {
+      itemStyle: Object,
+      params: Object
+    },
+
+    mixins: [mixin],
+
+    /**
+     * 组件的方法列表
+     * 更新属性和数据的方法与更新页面数据的方法类似
+     */
+    methods: {
+
+    }
+
+  }
+</script>
+
+<style lang="scss" scoped>
+  .diy-title {
+    padding: 10rpx 30rpx;
+
+    .title-content {
+      display: flex;
+      justify-content: space-between;
+
+      .title {
+        color: #323233;
+        font-size: 28rpx;
+        flex: 1;
+      }
+
+      .more-content {
+        color: #969799;
+        font-size: 24rpx;
+        margin-left: 40rpx;
+      }
+    }
+
+    .desc-content {
+      margin-top: 16rpx;
+      color: #969799;
+      font-size: 24rpx;
+    }
+
+  }
+</style>

+ 7 - 1
components/page/index.vue

@@ -73,6 +73,10 @@
       <block v-if="item.type === 'ICPLicense'">
         <ICPLicense :itemStyle="item.style" :params="item.params" />
       </block>
+      <!-- 文字标题 -->
+      <block v-if="item.type === 'title'">
+        <Title :itemStyle="item.style" :params="item.params" />
+      </block>
     </block>
   </view>
 </template>
@@ -96,6 +100,7 @@
   import DiyOfficialAccount from './diyComponents/officialAccount'
   import Coupon from './diyComponents/coupon'
   import ICPLicense from './diyComponents/ICPLicense'
+  import Title from './diyComponents/Title'
 
   export default {
     name: "Page",
@@ -117,7 +122,8 @@
       Special,
       DiyOfficialAccount,
       Coupon,
-      ICPLicense
+      ICPLicense,
+      Title
     },
     /**
      * 组件的属性列表