uni-im-view-msg.vue 2.3 KB
Newer Older
DCloud_JSON's avatar
DCloud_JSON 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 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
<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"
          size="25px"
          color="#ccc"
        />
      </view>
    </view>
    <scroll-view :scroll-y="true" class="content">
      <uni-im-msg
        v-for="(msg,index) in msgList"
        :key="index"
        :msg="msg"
      />
    </scroll-view>
  </view>
</view>
</template>

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

55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
<style lang="scss">
.uni-im-view-msg {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 20;
  width: 100vw;
  height: 100vh;
  max-width: 100vw !important;
  max-height: 100vh !important;
  background-color: rgba(0, 0, 0, .5);
  .msg-list {
    background-color: #fff;
    top: 25%;
  }
  /* #ifdef H5 */
  @media screen and (min-device-width:960px) {
    .msg-list {
      position: fixed;
      width: 600px;
      left: calc(50% - 300px);
    }
  }
78
  /* #endif */
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
  
  .msg-list .header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    background-color: rgba(250, 250, 250, 1);
    padding: 10px;
  }
  
  .msg-list .header .close {
    cursor: pointer;
  }
  
  .msg-list .title {
    font-size: 20px;
    color: #333;
  }
  
  .msg-list .content {
    padding: 10px;
    height: 400px;
    background-color: rgba(245, 245, 245, 1);
DCloud_JSON's avatar
DCloud_JSON 已提交
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
  }
  /* #ifdef H5 */
  @media screen and (min-device-width:960px) {
    .msg-list .content ::v-deep * {
      max-height: none !important;
    }
    #dialog {
      border-radius: 10px;
      border: none;
      padding: 0;
    }
    //  关闭 #dialog选中时的蓝色边框
    #dialog:focus {
      display: none;
    }
    #dialog::backdrop {
      background: rgba(0, 0, 0, .5);
    }
  }
  /* #endif */
122
}
DCloud_JSON's avatar
DCloud_JSON 已提交
123
</style>