重构项目文件夹目录
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
Page({
|
||||
data: {
|
||||
selected: '#7BA7C7',
|
||||
customColor: '#7BA7C7',
|
||||
wheelColors: [
|
||||
'#E0627A', '#E7785B', '#E2A64B', '#D8C85C', '#9EBB63', '#63B77B',
|
||||
'#4CB7A6', '#56A7D6', '#5F82D7', '#7C70D4', '#A66BC8', '#CF72A8'
|
||||
],
|
||||
recommendedColors: ['#7BA7C7', '#8FB89A', '#A894C7', '#D7A86E', '#D98DA5', '#79A6A3', '#B9A16B', '#9BA9C8'],
|
||||
paletteColors: [
|
||||
'#6F8F83', '#7BA7C7', '#8AAECA', '#9BA9C8', '#A894C7', '#C19AB7',
|
||||
'#D98DA5', '#D9958D', '#D7A86E', '#C8B47E', '#B9A16B', '#9FAD7B',
|
||||
'#8FB89A', '#79A6A3', '#6E9E92', '#A6B7A4', '#B8B0A6', '#C7B7A3',
|
||||
'#8E8A7D', '#A4A097', '#B6A6A0', '#C9A2A2', '#B58A8A', '#8C7C92',
|
||||
'#6D8491', '#829A9A', '#A9B3A2', '#C6B7D1', '#E0C2B6', '#F0D6A8'
|
||||
]
|
||||
},
|
||||
select(event) {
|
||||
const color = event.currentTarget.dataset.color
|
||||
this.setData({ selected: color, customColor: color })
|
||||
},
|
||||
selectWheelColor(event) {
|
||||
const color = event.currentTarget.dataset.color
|
||||
this.setData({ selected: color, customColor: color })
|
||||
},
|
||||
onCustomInput(event) {
|
||||
this.setData({ customColor: event.detail.value })
|
||||
},
|
||||
applyCustomColor() {
|
||||
let color = (this.data.customColor || '').trim()
|
||||
if (color && color[0] !== '#') color = `#${color}`
|
||||
if (!/^#[0-9a-fA-F]{6}$/.test(color)) {
|
||||
wx.showToast({ title: '请输入6位色值', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ selected: color.toUpperCase(), customColor: color.toUpperCase() })
|
||||
},
|
||||
save() { wx.showToast({ title: '已保存到本地' }) },
|
||||
back() { wx.navigateBack() }
|
||||
})
|
||||
Reference in New Issue
Block a user