Commit 973cdbc8 by 张杰

Merge branch 'zhangjie_v3.1' into 'dev_v3.1'

Zhangjie v3.1

See merge request !9
2 parents 1efd7a62 9145b1a5
// components/image/index.js
import {IMG_URL,IMG_VERSION} from '~/utils/constantData'
import {
IMG_URL,
IMG_VERSION
} from '~/utils/constantData'
Component({
externalClasses: ['custom-class','class'],
externalClasses: ['custom-class', 'class'],
/**
* 组件的属性列表
*/
properties: {
src: {
type: String,
value: ''
},
mode: {
type: String,
value: 'scaleToFill'
}
src: {
type: String,
value: ''
},
mode: {
type: String,
value: 'scaleToFill'
}
},
/**
* 组件的初始数据
*/
data: {
imagePath: ''
imagePath: ''
},
// 组件生命周期
lifetimes: {
// 在组件实例进入页面节点树时执行
attached: function () {
let src = this.data.src
let prefix = IMG_URL
this.setData({
imagePath: `${prefix}${src}` + IMG_VERSION()
})
},
// 在组件实例被从页面节点树移除时执行
detached: function () {
// 在组件实例进入页面节点树时执行
attached: function () {
let src = this.data.src
let prefix = IMG_URL
this.setData({
imagePath: `${prefix}${src}?v=` + IMG_VERSION()
})
},
// 在组件实例被从页面节点树移除时执行
detached: function () {
}
}
},
/**
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!