BigimageView.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <view style="width: 100%;height: 100%;">
  3. <movable-area class="zoomablev" :scale-area="true">
  4. <movable-view class="map-show-wrap" scale='true' direction='all' out-of-bounds='true' scale-max='2'>
  5. <view style="width:100vw;height: 100vh;">
  6. <image style="width:100%;height: 100%;" :src="compleurl(mysrc)" mode="aspectFit" @load="complet"></image>
  7. </view>
  8. </movable-view>
  9. </movable-area>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. data() {
  15. return {
  16. mysrc: '',
  17. baseUrl:'https://backend.awayqtw.com/prod-api',
  18. }
  19. },
  20. onLoad(option) {
  21. this.mysrc = option.mysrc;
  22. },
  23. methods: {
  24. compleurl(url){
  25. console.log('------compleurl',url)
  26. if(!url){
  27. return '';
  28. }
  29. if(url.length<8){
  30. return '';
  31. }
  32. uni.showLoading({
  33. title:'Loading...',
  34. mask:false
  35. })
  36. var http= url.substring(0,8);
  37. if(http==='https://'){
  38. return url;
  39. }
  40. else if(http==='/static/'){
  41. return url;
  42. }
  43. else if(http==='file:///'){
  44. return url;
  45. }
  46. else{
  47. return (this.baseUrl+url);
  48. }
  49. },
  50. complet(e){
  51. console.log(e);
  52. uni.hideLoading();
  53. },
  54. },
  55. }
  56. </script>
  57. <style scoped>
  58. /* 自定义样式 */
  59. .container {
  60. /* ... */
  61. }
  62. .zoomablev{
  63. width: 100vw;
  64. height: 100vh;
  65. }
  66. .map-show-wrap {
  67. width: 100%;
  68. height: 100%;
  69. }
  70. </style>