| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <template>
- <block>
- <!-- #ifdef H5 -->
- <img class="app-img" v-lazy="src" :alt="alt" :title="title" :mode="mode" />
- <!-- #endif -->
- <!-- #ifndef H5 -->
- <image class="app-img" :src="src" :alt="alt" :title="title" :lazy-load="true" :mode="mode" :style="{height: height + 'rpx'}" ></image>
- <!-- #endif -->
- </block>
- </template>
- <script>
- import Vue from 'vue'
- import VueLazyload from 'vue-lazyload'
- Vue.use(VueLazyload)
- export default {
- name: 'app-img',
- props: {
- src: {
- type: String,
- default: ''
- },
- alt: {
- type: String,
- default: ''
- },
- title: {
- type: String,
- default: ''
- },
- // #ifdef H5
- mode: {
- type: String,
- default: 'scaleToFill'
- },
- // #endif
- // #ifndef H5
- mode: {
- type: String,
- default: 'widthFix'
- },
- // #endif
- height: {
- type: Number,
- default: 346
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- </style>
|