diff --git a/plop/store-template/index.hbs b/plop/store-template/index.hbs index 702352da..5722a89d 100644 --- a/plop/store-template/index.hbs +++ b/plop/store-template/index.hbs @@ -5,7 +5,7 @@ import { StorageEnum } from '@/enums/storageEnum' export const use{{upperDataName}}Store = defineStore({ id: 'use{{upperDataName}}Store', - state: (): {{name}}StoreType => ({}), + state: (): {{upperDataName}}StoreType => ({}), getters: {}, actions: {} }) \ No newline at end of file diff --git a/plop/store-template/prompt.js b/plop/store-template/prompt.js index 180cbd26..4fab8a88 100644 --- a/plop/store-template/prompt.js +++ b/plop/store-template/prompt.js @@ -22,7 +22,7 @@ module.exports = { const actions = [ { type: 'add', - path: `${process.cwd()}/src/store/modules/${dataName}Store/${dataName}Store}.ts`, // 这里的name就是上面定义的键 + path: `${process.cwd()}/src/store/modules/${dataName}Store/${dataName}Store.ts`, // 这里的name就是上面定义的键 templateFile: './store-template/index.hbs', data: { name: data.name, @@ -32,7 +32,11 @@ module.exports = { { type: 'add', path: `${process.cwd()}/src/store/modules/${dataName}Store/${dataName}Store.d.ts`, // 这里的name就是上面定义的键 - templateFile: './store-template/index.d.hbs' + templateFile: './store-template/index.d.hbs', + data: { + name: data.name, + upperDataName, + } }, ]