edu.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <view>
  3. <painter style="position:fixed;top:-9999rpx" :palette="info" @imgOK="onImgOK"></painter>
  4. <image :src="image" style="width: 100%;height: 500rpx;"></image>
  5. </view>
  6. </template>
  7. <script>
  8. export default {
  9. data() {
  10. return {
  11. image:'',
  12. info: {
  13. width: "500rpx",
  14. height: "500rpx",
  15. background: "#eee",
  16. views: [{
  17. type: "image",
  18. url: "../../static/edu.png",
  19. },
  20. {
  21. type: "text",
  22. text: "未设置height、width时",
  23. css: {
  24. right: "0rpx",
  25. top: "60rpx",
  26. fontSize: "30rpx",
  27. },
  28. },
  29. {
  30. type: "image",
  31. url: "/static/edu.png",
  32. css: {
  33. width: "200rpx",
  34. height: "200rpx",
  35. top: "230rpx",
  36. },
  37. },
  38. {
  39. type: "text",
  40. text: "mode: 'aspectFill' 或 无",
  41. css: {
  42. left: "210rpx",
  43. fontSize: "30rpx",
  44. top: "290rpx",
  45. },
  46. },
  47. {
  48. type: "image",
  49. url: "/static/edu.png",
  50. css: {
  51. width: "200rpx",
  52. height: "200rpx",
  53. mode: "scaleToFill",
  54. top: "500rpx",
  55. },
  56. },
  57. {
  58. type: "text",
  59. text: "mode: 'scaleToFill'",
  60. css: {
  61. left: "210rpx",
  62. top: "560rpx",
  63. fontSize: "30rpx",
  64. },
  65. },
  66. {
  67. type: "image",
  68. url: "/static/edu.png",
  69. css: {
  70. width: "200rpx",
  71. height: "auto",
  72. top: "750rpx",
  73. },
  74. },
  75. {
  76. type: "text",
  77. text: "设置height为auto",
  78. css: {
  79. left: "210rpx",
  80. top: "780rpx",
  81. fontSize: "30rpx",
  82. },
  83. },
  84. ],
  85. }
  86. }
  87. },
  88. methods: {
  89. onImgOK(e) {
  90. console.log("ium",e)
  91. this.image = e.detail.path;
  92. },
  93. }
  94. }
  95. </script>
  96. <style scoped>
  97. </style>