预览功能实现

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

复制代码
        <!-- 预览 -->
        <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>
相关推荐
ai工具集合11 分钟前
老项目位图图标放大模糊?PNG 一键转 SVG 矢量化实操,附前端避坑指南
前端
2601_9687080313 分钟前
DreamsChat Web – Chat, Audio, Video Web APP with Admin Dashboard
前端·架构
Ai-_Man16 分钟前
Microsoft Copilot对话数据怎么导入到另外一个Microsoft Copilot账号里去?AI导出鸭
开发语言·javascript·人工智能·microsoft·chatgpt·ecmascript·copilot
小大宇18 分钟前
Vue知识点8-Watch
前端·javascript·vue.js
垆边人似月.19 分钟前
选型与快速跑通(Tesseract / EasyOCR / PaddleOCR)
前端·python
IT_陈寒20 分钟前
一文搞懂Java的核心概念
前端·人工智能·后端
铁皮饭盒24 分钟前
workbuddy和codebuddy免费送1000积分, 10秒钟搞定
前端·后端
aloha_78927 分钟前
HTML、JavaScript 与 TypeScript 基础速查
javascript·typescript·html
风骏时光牛马33 分钟前
从零到落地的AI系统学习进阶路线
前端
橙光成长3 小时前
PDF离线工具箱深度解析:4MB纯前端单文件,40+功能全本地运行,文件绝不上传
前端·pdf·1024程序员节