0
点赞
收藏
分享

微信扫一扫

一个基于SpringBoot+Vue前后端分离高校心理健康系统详细设计实现

源码之路 2023-08-19 阅读 60

方式1:

使用element-ui组件库中自带的组件直接进行放大。鼠标移动到其上时,会有单击放大的文字提示。

      <el-table-column label="头像" align="center" width="100px">
        <template slot-scope="scope">
          <el-popover placement="right" trigger="click">
            <div class="row_reserve">
              <img class="big-img" :src="scope.row.face_photo_path" />
            </div>
            <div slot="reference">
              <el-tooltip
                class="item"
                effect="light"
                content="单击放大"
                placement="left"
              >
                <img class="td-img" :src="scope.row.face_photo_path" />
              </el-tooltip>
            </div>
          </el-popover>
        </template>
      </el-table-column>

css部分,就是小盒子和点击之后的大盒子的css样式

.td-img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  padding: 0px;
  margin: 0px;
  cursor: pointer;
  background: transparent;
}
.big-img {
  width: 200px;
  height: 200px;
  border-radius: 10px;
  padding: 0px;
  margin: 0px;
  background: transparent;
}

方式二:

用别人已经写好的轮子,也会比自己写的更加美观,就比如说:使用 v-viewer 组件
第一步,安装
javascript npm install v-viewer --save
第二步:全局引入

import Viewer from 'v-viewer'  //点击图片大图预览
import 'viewerjs/dist/viewer.css'
Vue.use(Viewer)
Viewer.setDefaults({  //默认样式,可以按需求更改
  Options: { 'inline': true, 'button': true, 'navbar': true, 'title': true, 'toolbar': true, 'tooltip': true, 'movable': true, 'zoomable': true, 'rotatable': true, 'scalable': true, 'transition': true, 'fullscreen': true, 'keyboard': true, 'url': 'data-source' }
})

第三步:在表格中去使用

<el-table-column prop="imgPath" label="菜品图片" align="center" header-align="center">
	<template slot-scope="scope">
	  <viewer>
		<img :src="scope.row.imgPath" width="60px" />
	  </viewer>
	</template>
</el-table-column>

举报

相关推荐

0 条评论