mirror of
https://github.com/xiaoyiweb/YiAi.git
synced 2025-11-14 21:23:44 +08:00
初始化
This commit is contained in:
11
admin/plop-templates/store/index.hbs
Normal file
11
admin/plop-templates/store/index.hbs
Normal file
@@ -0,0 +1,11 @@
|
||||
const use{{ properCase name }}Store = defineStore(
|
||||
// 唯一ID
|
||||
'{{ camelCase name }}',
|
||||
{
|
||||
state: () => ({}),
|
||||
getters: {},
|
||||
actions: {},
|
||||
},
|
||||
)
|
||||
|
||||
export default use{{ properCase name }}Store
|
||||
28
admin/plop-templates/store/prompt.js
Normal file
28
admin/plop-templates/store/prompt.js
Normal file
@@ -0,0 +1,28 @@
|
||||
module.exports = {
|
||||
description: '创建全局状态',
|
||||
prompts: [
|
||||
{
|
||||
type: 'input',
|
||||
name: 'name',
|
||||
message: '请输入模块名称',
|
||||
validate: (v) => {
|
||||
if (!v || v.trim === '') {
|
||||
return '模块名称不能为空'
|
||||
}
|
||||
else {
|
||||
return true
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
actions: () => {
|
||||
const actions = [
|
||||
{
|
||||
type: 'add',
|
||||
path: 'src/store/modules/{{camelCase name}}.ts',
|
||||
templateFile: 'plop-templates/store/index.hbs',
|
||||
},
|
||||
]
|
||||
return actions
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user