index.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <view class="content">
  3. <view class="top"></view>
  4. <view class="te"></view>
  5. <image @click="previewImage" src="http://dmsimg.66km.com/thFiles/7C057545-E11E-40F5-AD3C-637EF653B417.jpg" mode=""></image>
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. data() {
  11. return {
  12. ImageList: [
  13. {
  14. imgUrl:"http://dmsimg.66km.com/thFiles/7C057545-E11E-40F5-AD3C-637EF653B417.jpg",
  15. acronymUrl:"http://dmsimg.66km.com/thFiles/7C057545-E11E-40F5-AD3C-637EF653B417.jpg",
  16. picture:false,
  17. }
  18. ]
  19. }
  20. },
  21. onLoad() {
  22. },
  23. methods: {
  24. previewImage(){
  25. var arr = [];
  26. var img='http://dmsimg.66km.com/thFiles/7C057545-E11E-40F5-AD3C-637EF653B417.jpg'
  27. arr.push(img)
  28. // 预览图片
  29. uni.previewImage({
  30. urls: arr,
  31. current: img,
  32. longPressActions: {
  33. itemList: ['发送给朋友', '保存图片', '收藏'],
  34. success: function(data) {
  35. console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  36. },
  37. fail: function(err) {
  38. console.log(err.errMsg);
  39. }
  40. }
  41. });
  42. }
  43. }
  44. }
  45. </script>
  46. <style scoped>
  47. .top{
  48. width: 100vw;
  49. height: 20px;
  50. background: red;
  51. }
  52. .te{
  53. width: 960px;
  54. height: 20px;
  55. background: yellow;
  56. }
  57. </style>