<template>
  <view class="page-title" @click="clickTitleHandler" :style="{'background':ts.background}">
    <img
      :src="ts.picUrl"
      :style="{'width':ts.fontSize+'rpx','height':ts.fontSize+'rpx'}"
      v-if="ts.style=='1' && ts.picSwitch"
    />
    <view class="content">
      <view
        v-if="ts.style=='1'"
        :style="{'text-align':ts.position,'font-size':ts.fontSize+'rpx','color':ts.color}"
      >
		<span style="display: inline-block;position: relative;">
			<text style="position: relative;z-index: 2;">{{ts.title}}</text>
			<span style="background-color: #DFBE6E;height: 6px;bottom: 2px;left: 0;right: 0;position: absolute;z-index: 1;"></span>
		</span>
	  </view>
      <view v-else-if="ts.style=='2'" class="style2">
        <view
          class="text"
          :style="{'font-size':ts.fontSize+'rpx','color':ts.color,'background':ts.background}"
        >{{ts.title}}</view>
        <view class="line" :style="{'background':ts.styleColor}"></view>
      </view>
      <view v-else-if="ts.style=='3'" class="style3">
        <view
          class="text"
          :style="{'font-size':ts.fontSize+'rpx','color':ts.color,'background':ts.background}"
        >{{ts.title}}</view>
        <view class="line" :style="{'border-color':ts.styleColor}"></view>
      </view>
      <view v-else-if="ts.style=='4'" class="style4">
        <view
          class="text"
          :style="{'font-size':ts.fontSize+'rpx','color':ts.color,'background':ts.background}"
        >{{ts.title}}</view>
        <view class="line" :style="{'background':ts.styleColor}"></view>
      </view>
      <view v-else class="style5">
        <view
          class="text"
          :style="{'font-size':ts.fontSize+'rpx','color':ts.color,'background':ts.background}"
        >{{ts.title}}</view>
        <view class="line" :style="{'border-color':ts.styleColor}"></view>
      </view>
    </view>
    <view class="arrowRight" v-if="ts.arrowsSwitch">
      <!-- <u-icon name="arrow" :size="ts.fontSize" /> -->
		<text>更多</text>
    </view>
  </view>
</template>

<script>
export default {
  props: ["ts"],
  data() {
    return {};
  },
  methods: {
    clickTitleHandler() {
		console.log(this.ts)
      if (
        this.ts.link &&
        this.ts.link.name &&
        this.ts.link.name != ""
      ) {
        uni.navigateTo({ url: this.ts.link.name });
      }
    }
  }
};
</script>

<style>
.page-title {
  padding: 10px;
  display: flex;
  align-items: center;
}
.page-title .content {
  flex: 1;
  width: 1rpx;
  margin-left: 12rpx;
  text-align: center;
}
.page-title .content .style2 {
  margin: 0 auto;
  display: inline-block;

  position: relative;
}
.page-title .content .style2 .text {
  position: relative;
  z-index: 2;
  padding: 0 20px;
}
.page-title .content .style2 .line {
  height: 2px;
  /* border:1px solid #FFF; */
  display: block;
  content: " ";
  position: absolute;
  top: 50%;
  margin-top: -2px;
  left: -40px;
  right: -40px;
  z-index: 1;
}
.page-title .content .style3 {
  margin: 0 auto;
  display: inline-block;
  position: relative;
}
.page-title .content .style3 .text {
  position: relative;
  z-index: 2;
  padding: 0 10px;
}
.page-title .content .style3 .line {
  height: 6px;
  border: 2px solid transparent;
  display: block;
  content: " ";
  position: absolute;
  top: 50%;
  margin-top: -5px;
  left: -15px;
  right: -15px;
  z-index: 1;
  border-left: none;
  border-right: none;
}
.page-title .content .style4 {
  margin: 0 auto;
  display: block;
  position: relative;
}
.page-title .content .style4 .text {
  padding-left: 12px;
  text-align: left;
}
.page-title .content .style4 .line {
  height: 14px;
  width: 2px;
  /* border:1px solid #FFF; */
  display: block;
  content: " ";
  position: absolute;
  top: 50%;
  margin-top: -7px;
  left: 0px;
  z-index: 1;
}
.page-title .content .style5 {
  margin: 0 auto;
  display: block;
  position: relative;
}
.page-title .content .style5 .text {
  padding-left: 24px;
  text-align: left;
}
.page-title .content .style5 .line {
  height: 10px;
  width: 10px;
  border: 1px solid transparent;
  display: block;
  content: " ";
  position: absolute;
  top: 50%;
  margin-top: -5px;
  left: 0px;
  z-index: 1;
  border-radius: 100%;
}
.page-title .arrowRight {
  width: 24px;
  margin-right: 10px;
  text-align: right;
  font-size: 12px;
  color: #999999;
}
</style>