-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathui.js
43 lines (43 loc) · 978 Bytes
/
ui.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
module.exports = api => {
api.describeConfig({
id: 'vueconf.demo',
name: 'vueconf',
files: {
vue: {
js: ['vue.config.js']
}
},
onRead: ({
data
}) => {
return {
prompts: [{
name: 'themeColor',
type: 'color',
message: '选择一种配置的颜色',
default: '#4DBA87',
value: data.vue.pluginOptions && data.vue.pluginOptions.vueconf && data.vue.pluginOptions.vueconf.themeColor
},
{
name: 'welcome',
type: 'input',
message: '项目介绍',
description: '请输入这个项目的介绍',
default: 'Learn React',
value: data.vue.pluginOptions && data.vue.pluginOptions.vueconf && data.vue.pluginOptions.vueconf.welcome
}
]
}
},
onWrite: async ({
api,
prompts
}) => {
const result = {}
for (const prompt of prompts) {
result[`pluginOptions.vueconf.${prompt.id}`] = await api.getAnswer(prompt.id)
}
api.setData('vue', result)
}
})
}