预览功能实现

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

复制代码
        <!-- 预览 -->
        <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>
相关推荐
冬奇Lab1 小时前
AI Workflow 定义的四次演进:从 Markdown 到 JS 脚本,再到分布式多 Agent
javascript·人工智能·agent
zhangxingchao1 小时前
Kotlin常用的Flow 操作符整理
前端
IT_陈寒3 小时前
React的useState居然还有这种坑?我差点删库跑路
前端·人工智能·后端
Pedantic4 小时前
SwiftUI 手势笔记
前端·后端
橙子家4 小时前
浏览器缓存之【结构化数据库与缓存】: IndexedDB、Cache storage 和 Storage buckets
前端
user20585561518135 小时前
X6 中边悬浮置顶,规避 `mouseleave` 事件丢失问题
前端
李明卫杭州5 小时前
CSS aspect-ratio 属性完全指南
前端
Pedantic6 小时前
SwiftUI 手势层级(Gesture Hierarchy)详解
前端
飘尘7 小时前
前端转型全栈(Java后端)的快速上手指引
前端·后端·全栈