预览功能实现

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

复制代码
        <!-- 预览 -->
        <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>
相关推荐
托比-马奎尔8 分钟前
ES6变量与解构:let、const与模板字符串全解析
javascript
excel15 分钟前
JavaScript 并发编程实战:用 Atomics 与 SharedArrayBuffer 玩转多线程与视频渲染
前端
不在了情绪39 分钟前
CSS 基础语法 + 弹性盒子
前端·css
水煮白菜王1 小时前
从零搭建 React 工程化项目
前端·javascript·react.js
会飞的鱼先生1 小时前
react的基本使用
前端·react.js·前端框架
chenglin0161 小时前
C#_接口设计:角色与契约的分离
java·前端·c#
mosen8681 小时前
易混淆的CommonJS和ESM(ES Module)及它们区别
javascript·node.js·express
chenglin0161 小时前
ES_多表关联
java·前端·elasticsearch
weixin_516875654 小时前
力扣 30 天 JavaScript 挑战 第37天 第九题笔记 知识点: 剩余参数,拓展运算符
javascript·笔记·leetcode
明月与玄武4 小时前
Vue 3 高性能实践 全面提速剖析!
前端·javascript·vue.js