<template>
  <div class="PersonafFollow">
    <div class="answer">
      <div class="user">
        <div class="left">
            <img :src="img" alt srcset class="photo" />
        <div class="userinfo">
          <p>{{nickname}}</p>
          <p>{{sole}}</p>
        </div>
        </div>
      
          <div class="right">
            <!-- <div class="add"> -->
            <img src="../assets/add.png" alt class="add" />
            <!-- </div> -->
            <p>关注</p>
          </div>
      </div>
          <!-- <div class="line"></div> -->
    <p class="question">{{title}}</p>
    <!-- <div class="line"></div> -->
      <!-- <div class="agree">1345人赞同了该回答</div> -->
      <div class="agree">{{date}}</div>
      <div class="content" v-html="text">
       <!-- <div v-ho></div> -->
        <!-- <div v-show="show" @click="shows">展开阅读全文</div> -->
      </div>
      <div class="operation">
        <div>
          <img src="../assets/share.png" alt srcset />
          分享
        </div>
        <div @click="$emit('pinglun')">
          <img src="../assets/pl.png" alt srcset />
          {{num}}评论
        </div>
        <div></div>
        <!-- <div v-show="!show && lang" @click="hadd">收起</div> -->
      </div>
    </div>
  </div>
</template>
<style lang="scss" scoped>
.line {
  height: 0.2rem;
  width: 100%;
  background-color: #f6f6f6;
}
.question {
  margin-top: 0.3rem;
  height: auto;
  width: 100%;
  color: #333333;
  font-size: 0.36rem;
  text-indent: 0.3rem;
  line-height: 0.45rem;
  font-weight: 500;
}
.title {
  color: #333333;
  font-size: 0.34rem;
  margin-top: 0.48rem;
  text-indent: 0.31rem;
}
.PersonafFollow {
  padding: 0 36px 39px 30px;
  border-bottom: 1px solid #dfdfdf;
  .title {
    display: flex;
    justify-content: space-between;
    font-size: 26px;
    color: #95998f;
    margin-bottom: 28px;
  }
  .center {
    font-size: 30px;
    color: #000;
    line-height: 46px;
  }
  .answer {
    .user {
      display: flex;
      align-items: center;
      margin-top: 34px;
      justify-content: space-between;
      .left{
        display: flex;
      }
      .photo {
        width: 68px;
        height: 68px;
        border-radius: 4px;
        margin-right: 20px;
      }
      .userinfo {
        display: flex;
        flex-direction: column;
        > p {
          font-size: 30px;
          color: #000;
        }
        > p:last-child {
          width:360px;
          margin-top: 10px;
          font-size: 24px;
          color: #999;
              overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
        }
      }
    }
    .agree {
      margin-top: 29px;
      font-size: 26px;
      color: #95998f;
    }
    .content {
      position: relative;

      // overflow: hidden;
      /deep/ img {
        width: 690px; 
        height: 374px;
        // background-color: #000;  
        display: block;
        margin-top: 39px;
        margin-bottom: 32px;
      }
      > p {
        line-height: 40px;
        font-size: 26px;
      }
      > div {
        position: absolute;
        width: 750px;
        height: 45px;
        background-color: #fff;
        bottom: 0px;
        line-height: 35px;
        font-size: 24px;
        color: #465a33;
        text-align: center;
        left: -30px;
        box-shadow: 0px 0px 30px #fff;
      }
    }
    .operation {
      display: flex;
      margin-top: 30px;
      > div {
        margin-right: 60px;
        font-size: 22px;
        color: #95998f;
        > img {
          width: 17px;
          height: 17px;
          margin-right: 11px;
        }
      }
      > div:last-child {
        margin-left: 300px;
        margin-right: 0;
      }
    }
  }
}
  .right {
    width: 143px;
    height: 62px;
    line-height: 62px;
    background: rgba(247, 247, 247, 1);
    border-radius: 10px;
    margin: auto 0;
    margin-right: 30px; 
    display: flex!important;
    flex-direction: row!important;
    justify-content: center!important;
    color: #6b9147;
    font-size: 28px;
    float: right;
    .add {
      width: 24px;
      height: 24px;
      margin-top: 19px;
      margin-right: 21px;
    }
  }
</style>
<script>
export default {
  name: "PersonafFollow",
  data() {
    return {
      show: false,
      lang: true
    };
  },

  methods: {
    shows() {
      var a = window.document.getElementsByClassName("content")[this.indexs];
      a.style.setProperty("max-height", "", "important");
      this.show = false;
    },
    hadd() {
      var a = window.document.getElementsByClassName("content")[this.indexs];
      a.style.setProperty("max-height", "6.1rem", "important");
      this.show = true;
    }
  },
  mounted() {
    this.$nextTick(() => {
      window.console.log(122);
      var a = window.document.getElementsByClassName("content")[this.indexs];

      var rem = parseFloat(
        window.getComputedStyle(window.document.documentElement)["fontSize"]
      );
      window.console.log(a.offsetHeight, 5.9 * rem);
      if (a.offsetHeight > 5.9 * rem) {
        this.show = true;
      } else {
        this.lang = false;
      }
    });
  },
  props:['img','nickname','sole','title','date','num','text']
};
</script>