Initial commit: 积分兑换电商平台多商户版 MER-2.2
Made-with: Cursor
This commit is contained in:
18
mer_plat_admin/plop-templates/component/index.hbs
Normal file
18
mer_plat_admin/plop-templates/component/index.hbs
Normal file
@@ -0,0 +1,18 @@
|
||||
{{#if template}}
|
||||
<template>
|
||||
<div />
|
||||
</template>
|
||||
{{/if}}
|
||||
|
||||
{{#if script}}
|
||||
<script>
|
||||
export default { name: '{{properCase name}}', props: {}, data() { return {} }, created() {}, mounted() {}, methods:
|
||||
{} }
|
||||
</script>
|
||||
{{/if}}
|
||||
|
||||
{{#if style}}
|
||||
<style lang='scss' scoped>
|
||||
|
||||
</style>
|
||||
{{/if}}
|
||||
59
mer_plat_admin/plop-templates/component/prompt.js
Normal file
59
mer_plat_admin/plop-templates/component/prompt.js
Normal file
@@ -0,0 +1,59 @@
|
||||
const { notEmpty } = require('../utils.js');
|
||||
|
||||
module.exports = {
|
||||
description: 'generate vue component',
|
||||
prompts: [
|
||||
{
|
||||
type: 'input',
|
||||
name: 'name',
|
||||
message: 'component name please',
|
||||
validate: notEmpty('name'),
|
||||
},
|
||||
{
|
||||
type: 'checkbox',
|
||||
name: 'blocks',
|
||||
message: 'Blocks:',
|
||||
choices: [
|
||||
{
|
||||
name: '<wxTemplate>',
|
||||
value: 'template',
|
||||
checked: true,
|
||||
},
|
||||
{
|
||||
name: '<script>',
|
||||
value: 'script',
|
||||
checked: true,
|
||||
},
|
||||
{
|
||||
name: 'style',
|
||||
value: 'style',
|
||||
checked: true,
|
||||
},
|
||||
],
|
||||
validate(value) {
|
||||
if (value.indexOf('script') === -1 && value.indexOf('template') === -1) {
|
||||
return 'Components require at least a <script> or <wxTemplate> tag.';
|
||||
}
|
||||
return true;
|
||||
},
|
||||
},
|
||||
],
|
||||
actions: (data) => {
|
||||
const name = '{{properCase name}}';
|
||||
const actions = [
|
||||
{
|
||||
type: 'add',
|
||||
path: `src/components/${name}/index.vue`,
|
||||
templateFile: 'plop-templates/component/index.hbs',
|
||||
data: {
|
||||
name: name,
|
||||
template: data.blocks.includes('template'),
|
||||
script: data.blocks.includes('script'),
|
||||
style: data.blocks.includes('style'),
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
return actions;
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user