pic.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template name="pic">
  2. <view class="cover cover-height">
  3. <block v-if="item.text.length > 0">
  4. <image @click="Dever.viewPic([item.pic], item.pic)" :src="item.pic" mode="widthFix" :class="['default', 'slide-image', 'slide-image-'+item.type]" style="height:auto"></image>
  5. <dever-position :item="item.text" :down="item.pic" :button="item.is_button"></dever-position>
  6. </block>
  7. <block v-if="item.text.length <= 0">
  8. <image @load="loadImg" @click="Dever.viewPic([item.pic], item.pic)" :src="item.pic" mode="widthFix" :class="['default', 'slide-image', 'slide-image-'+item.type]" style="height:auto"></image>
  9. </block>
  10. </view>
  11. </template>
  12. <script>
  13. import deverPosition from "@/lib/dever/components/position.vue";
  14. export default {
  15. name: "pic",
  16. props: {
  17. control : {
  18. type : Object,
  19. value : null
  20. },
  21. item : {
  22. type : Object,
  23. value : null
  24. },
  25. index : 0,
  26. pic_index : 0,
  27. },
  28. methods:{
  29. loadImg : function(e) {
  30. var height = e.detail.height / (e.detail.width / this.Dever.config.system.windowWidth);
  31. this.$emit('setHeight', this.pic_index, height);
  32. }
  33. },
  34. components:{
  35. deverPosition
  36. }
  37. }
  38. </script>
  39. <style>
  40. .cover{
  41. position: relative;
  42. width: 100%;
  43. height: 100%;
  44. }
  45. .cover-height{
  46. overflow: auto;
  47. position: absolute;
  48. top:0;
  49. left:0;
  50. width:100%;
  51. height:100%;
  52. }
  53. .slide-image {
  54. }
  55. .slide-image-1 {
  56. width: 750rpx;
  57. height: 1386rpx;
  58. display: block;
  59. }
  60. .slide-image-2 {
  61. width: 2000rpx;
  62. height: 100%;
  63. display: block;
  64. }
  65. .long-wrapper {
  66. position: relative;
  67. }
  68. </style>