预览功能实现

需求:将后端返回来的文字或者图片和视频展示在页面上。

复制代码
        <!-- 预览 -->
        <el-dialog title="预览" :visible.sync="dialogPreviewVisible" width="50%" append-to-body :close-on-click-modal="false" @close="PreviewClose">
          <div style="margin-bottom:5%">
            <h1>{{previewTitle}}</h1>
          </div>
          <div class="content" v-html="previewContent">
          </div>
        </el-dialog>
      
// 预览事件
      previewButton(row){
        let _this = this;
        let isNull = validatenull;
        getDetails(row.id).then((res)=>{
          if(res.data.code == 0){
            _this.dialogPreviewVisible = true;
            console.log(res.data.data,'预览');
            _this.previewTitle = res.data.data.title
            _this.previewContent = res.data.data.content
            console.log(res.data.data.content,'66666');
          }
        })
      },


  <style scoped lang="scss">
  .titleClass{
    display:flex;
    justify-content: center;
  }
  .content{
   /deep/ p{
           img{
             width: 100% !important;
           }
         }
    /deep/ .ql-video{
        position: static;
        }
      }
  </style>
相关推荐
桃子叔叔1 分钟前
react-wavesurfer录音组件2:前端如何处理后端返回的仅Blob字段
前端·react.js·状态模式
nie_xl4 分钟前
VS/TRAE中设置本地maven地址的方法
运维·服务器·前端
烧饼Fighting9 分钟前
统信UOS操作系统离线安装ffmpeg
开发语言·javascript·ffmpeg
LV技术派11 分钟前
适合很多公司和团队的 AI Coding 落地范式(三)
前端·ai编程·cursor
一只小bit13 分钟前
Qt 对话框全方面详解,包含示例与解析
前端·c++·qt·cpp·页面
m0_7482546613 分钟前
Angular 2 模板语法概述
前端·javascript·angular.js
专注VB编程开发20年14 分钟前
EDGE估计没有switch到frame的做法
前端·edge·vba
_oP_i21 分钟前
Chrome浏览器自动下载的AI模型文件
前端·chrome
小小前端--可笑可笑22 分钟前
【Three.js + MediaPipe】视频粒子特效:实时运动检测与人物分割技术详解
开发语言·前端·javascript·音视频·粒子特效