uni-im-view-msg.vue 1.9 KB
Newer Older
DCloud_JSON's avatar
DCloud_JSON 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
<template>
<view
  v-if="showMsgList"
  class="uni-im-view-msg"
  @click="close()"
>
  <view class="msg-list" @click.stop>
    <view class="header">
      <view class="title">
        转发的消息内容
      </view>
      <view class="close" @click="close">
        <uni-icons
          type="clear"
DCloud_JSON's avatar
3.4.31  
DCloud_JSON 已提交
15
          size="20px"
DCloud_JSON's avatar
DCloud_JSON 已提交
16 17 18 19
          color="#ccc"
        />
      </view>
    </view>
DCloud_JSON's avatar
3.4.31  
DCloud_JSON 已提交
20 21 22 23 24 25 26 27 28
    <scroll-view :scroll-y="true" class="scroll-view">
      <view class="scroll-content">
        <uni-im-msg
          v-for="(msg,index) in msgList"
          :key="index"
          :msg="msg"
          :preview="true"
        />
      </view>
DCloud_JSON's avatar
DCloud_JSON 已提交
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
    </scroll-view>
  </view>
</view>
</template>

<script>
export default {
  name: 'UniImViewMsg',
  data() {
    return {
      showMsgList: false,
      msgList: [],
    }
  },
  methods: {
    open(msgList) {
      this.showMsgList = true;
      this.msgList = msgList;
    },
    close() {
      this.showMsgList = false;
      this.msgList = [];
    }
  }
}
</script>

56 57
<style lang="scss">
.uni-im-view-msg {
DCloud_JSON's avatar
3.4.31  
DCloud_JSON 已提交
58
  position: fixed !important;
59 60
  top: 0;
  left: 0;
DCloud_JSON's avatar
3.4.31  
DCloud_JSON 已提交
61 62 63
  z-index: 10;
  width: 100%;
  height: 100%;
64 65
  background-color: rgba(0, 0, 0, .5);
  .msg-list {
DCloud_JSON's avatar
3.4.31  
DCloud_JSON 已提交
66 67 68 69 70
    position: absolute;
    bottom: 0;
    width: 100%;
    overflow: hidden;
    border-radius: 10px;
71
    background-color: rgba(245, 245, 245, 1);
DCloud_JSON's avatar
3.4.31  
DCloud_JSON 已提交
72 73 74 75 76 77 78 79 80 81 82
    height: unset !important;
    padding-bottom: 10px;
    .header {
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid #eee;
      padding: 10px;
      .close {
        cursor: pointer;
      }
DCloud_JSON's avatar
DCloud_JSON 已提交
83
    }
DCloud_JSON's avatar
3.4.31  
DCloud_JSON 已提交
84 85 86
    .title {
      font-size: 16px;
      color: #333;
DCloud_JSON's avatar
DCloud_JSON 已提交
87
    }
DCloud_JSON's avatar
3.4.31  
DCloud_JSON 已提交
88 89 90 91 92
    .scroll-view {
      height: 400px;
      .scroll-content {
        margin: 10px;
      }
DCloud_JSON's avatar
DCloud_JSON 已提交
93
    }
DCloud_JSON's avatar
3.4.31  
DCloud_JSON 已提交
94 95 96 97 98 99 100 101
  }
  /* #ifdef H5 */
  @media screen and (min-device-width:960px) {
    .msg-list {
      position: relative;
      width: 60%;
      top: 25%;
      left: 20%;
DCloud_JSON's avatar
DCloud_JSON 已提交
102 103 104
    }
  }
  /* #endif */
105
}
DCloud_JSON's avatar
DCloud_JSON 已提交
106
</style>