Vue 和CSS 图片展示和旋转

js代码

 

<script>
$(function () {
Vue.config.delimiters = ['${', '}'];
var v = new Vue({
el: 'body',
data: {
images: {{ images | json_encode }},
show_img: false,
show_img_url: null,
deg: 0,
},
methods: {
show_image: function (url) {
v.img_deg = 0;
$("#show_image").css('transform', 'rotate(0deg)');

this.show_img = true;
this.show_img_url = url;
},
none: function () {
this.show_img = false;
},
left: function () {
var v = this;
v.deg += 90;
},
right: function () {
var v = this;
v.deg -= 90;
}
}
});


});

</script>
html:
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>图片查看</h5>
</div>

<div class="ibox-content">
<div class="row">

<div class="col-sm-12" id="gallery-image">
<table class="table table-bordered table-hover">
<tbody>
<tr>
<td>
<a v-for="image in images" @click="show_image(image.url)">
<img src="${image.url}?imageView2/1/w/300/h/200"/>
</a>
</td>


</tr>
</tbody>
</table>

</div>
</div>
<div style="text-align: center;position: fixed;width: 100%;height: 100%;top:0;left:0;z-index:999;background-color: rgba(0,0,0,0.8)"
v-show="show_img" @click="none">
<div style="width: 100%;height: 100%;">
<img :src="show_img_url" id="show_image"
v-bind:style="'width: 50%;margin-top:5%;transform-origin:50% 50%;transform:rotate('+deg+'deg)'"
@click.stop="">

<div style="position: fixed;width: 100%;width: 100%;text-align: center;bottom: 5%">
<button class="btn" @click.stop="left">左转90度</button>
<button class="btn" @click.stop="right">右转90度</button>
</div>

</div>

</div>

</div>

</div>


 

转载于:https://www.cnblogs.com/zhouhaha/p/9072130.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值