calckey/src/client/app/common/views/components/image-viewer.vue

71 lines
1.0 KiB
Vue
Raw Normal View History

2018-02-12 00:06:22 +00:00
<template>
2018-11-07 17:09:15 +00:00
<div class="dkjvrdxtkvqrwmhfickhndpmnncsgacq">
2018-02-12 00:06:22 +00:00
<div class="bg" @click="close"></div>
<img :src="image.url" :alt="image.name" :title="image.name" @click="close"/>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
2019-01-18 04:06:11 +00:00
import anime from 'animejs';
2018-02-12 00:06:22 +00:00
export default Vue.extend({
props: ['image'],
mounted() {
anime({
targets: this.$el,
opacity: 1,
duration: 100,
easing: 'linear'
});
},
methods: {
close() {
anime({
targets: this.$el,
opacity: 0,
duration: 100,
easing: 'linear',
2018-09-15 12:53:04 +00:00
complete: () => this.destroyDom()
2018-02-12 00:06:22 +00:00
});
}
}
});
</script>
<style lang="stylus" scoped>
2018-11-07 17:09:15 +00:00
.dkjvrdxtkvqrwmhfickhndpmnncsgacq
2018-02-12 00:06:22 +00:00
display block
position fixed
z-index 2048
top 0
left 0
width 100%
height 100%
opacity 0
> .bg
display block
position fixed
z-index 1
top 0
left 0
width 100%
height 100%
2018-04-28 23:51:17 +00:00
background rgba(#000, 0.7)
2018-02-12 00:06:22 +00:00
> img
position fixed
z-index 2
top 0
right 0
bottom 0
left 0
max-width 100%
max-height 100%
margin auto
cursor zoom-out
image-orientation from-image
2018-02-12 00:06:22 +00:00
</style>