-
-
Notifications
You must be signed in to change notification settings - Fork 626
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(cli): improve create command template code (#1796)
- Loading branch information
1 parent
0a2e43a
commit 47e1019
Showing
2 changed files
with
16 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 15 additions & 10 deletions
25
packages/varlet-cli/template/create/[ComponentName].vue.ejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,25 @@ | ||
<template> | ||
<div class="<%- namespace %>-<%- kebabCaseName %>"></div> | ||
<div :class="n()"></div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue' | ||
import { props } from './props' | ||
import { createNamespace } from '../utils/components' | ||
import { defineComponent } from 'vue' | ||
import { props } from './props' | ||
import { createNamespace } from '../utils/components' | ||
const { name, n, classes } = createNamespace('<%- kebabCaseName %>') | ||
const { name, n, classes } = createNamespace('<%- kebabCaseName %>') | ||
export default defineComponent({ | ||
name, | ||
props | ||
}) | ||
export default defineComponent({ | ||
name, | ||
props, | ||
setup(props) { | ||
return { | ||
n, | ||
} | ||
}, | ||
}) | ||
</script> | ||
|
||
<style lang="less"> | ||
@import './<%- camelizeName %>'; | ||
@import './<%- camelizeName %>'; | ||
</style> |