for (let i = 0; i < types.length; ++i) {
(function (type) {
pageObject[type] = function (e) {
const key = type + 'Size'
const changedData = {}
changedData[key] =
this.data[key] === 'default' ? 'mini' : 'default'
this.setData(changedData)
}
}(types[i]))
}
里面 function 是什么? js 有这样的语法?
(function (type) {
pageObject[type] = function (e) {
const key = type + 'Size'
const changedData = {}
changedData[key] =
this.data[key] === 'default' ? 'mini' : 'default'
this.setData(changedData)
}
}(types[i]))
}
里面 function 是什么? js 有这样的语法?