| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- /** 图片预览 */
- <template>
- <Modal
- ref="modal"
- :large="true"
- >
- <div class="modal-img-box">
- <img
- :src="src"
- class="m-img"
- />
- </div>
- <template #header>
- <slot>
- {{ $t('lang.imagePreview.imagePreview') }}
- </slot>
- </template>
- </Modal>
- </template>
- <script>
- var Common = require('../../common/Common.js')
- var Modal = require('../../modal/src/Modal.vue').default
- export default {
- name: 'ImagePreview',
- components: {
- Modal,
- },
-
- props: {
- 'className':{
- type: String,
- },
- 'imageName':{
- type: String,
- },
- },
- data: function () {
- return {
- 'src': null,
- }
- },
- methods: {
- /**
- * 预览图片
- */
- preview: function (className, imageName) {
- if (imageName != null && imageName != '') {
- this.$refs.modal.show = true
- this.src = Common.getImageSrc(className, imageName)
- }
- },
- /**
- * 预览图片
- */
- previewImage: function (imageName) {
- this.$refs.modal.show = true
- this.src = imageName
- },
- },
- }
- </script>
- <style scoped>
- .modal-img-box {
- width: 100%;
- text-align: center;
- overflow: auto;
- }
- .m-img {
- width: 60%;
- }
- </style>
|