<!--
  Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.

  https://www.mall4j.com/

  未经允许，不可做商业用途！

  版权所有，侵权必究！
-->

<template>
  <view class="Mall4j component-title-text">
    <view class="title-row">
      <view
        class="title"
        :style="{
          textAlign: fieldData.align,
          fontSize: fieldData.titleSize + 'px',
          fontWeight: fieldData.titleWeight,
        }"
      >
        {{ fieldData.title }}
      </view>
      <view
        v-if="fieldData.isLink"
        class="title-more"
        @tap="viewMore"
      >
        <view
          v-if="fieldData.linkStyle !== 3"
          class="more-text"
        >
          {{
            fieldData.linkText
          }}
        </view>
        <view
          v-if="fieldData.linkStyle !== 1"
          class="more-icon"
        >
          <image
            src="@/static/images/more.png"
          />
        </view>
      </view>
    </view>
    <view
      v-if="fieldData.desc"
      class="decs-row"
      :style="{
        width: '100%',
        textAlign: fieldData.align,
        fontSize: fieldData.descSize + 'px',
        fontWeight: fieldData.descWeight,
      }"
    >
      {{ fieldData.desc }}
    </view>
  </view>
</template>

<script setup>
import util from '@/utils/util'

const props = defineProps({
  fieldData: {
    type: Object,
    default: () => {
      return {}
    }
  },
  shopId: {
    type: [Number, String],
    default: 0
  }
})

/**
 * 点击查看更多
 */
const viewMore = () => {
  if (props.fieldData.path) {
    util.toRedirectLink(props.fieldData.path.type, props.fieldData.path.link, props.shopId)
  }
}

</script>

<style lang="scss" scoped>
@use "index";
</style>
