预览功能实现

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

复制代码
        <!-- 预览 -->
        <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>
相关推荐
树上有只程序猿5 分钟前
终于有人把数据库讲明白了
前端
猩兵哥哥11 分钟前
前端面向对象设计原则运用 - 策略模式
前端·javascript·vue.js
司宸11 分钟前
Prompt设计实战指南:三大模板与进阶技巧
前端
RoyLin14 分钟前
TypeScript设计模式:抽象工厂模式
前端·后端·typescript
华仔啊19 分钟前
Vue3+CSS 实现的 3D 卡片动画,让你的网页瞬间高大上
前端·css
江城开朗的豌豆27 分钟前
解密React虚拟DOM:我的高效渲染秘诀 🚀
前端·javascript·react.js
vivo互联网技术35 分钟前
拥抱新一代 Web 3D 引擎,Three.js 项目快速升级 Galacean 指南
前端·three.js
江城开朗的豌豆43 分钟前
React应用优化指南:让我的项目性能“起飞”✨
前端·javascript·react.js
会飞的青蛙1 小时前
GIT 配置别名&脚本自动化执行
前端·git