Skip to content

Commit

Permalink
refactor(cli): improve create command template code (#1796)
Browse files Browse the repository at this point in the history
  • Loading branch information
chouchouji authored Oct 11, 2024
1 parent 0a2e43a commit 47e1019
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default defineComponent({
props,
setup(props, { slots }) {
return () => {
return <div class="<%- namespace %>-<%- kebabCaseName %>">{ slots.default?.() }</div>
return <div class={n()}>{ slots.default?.() }</div>
}
},
})
25 changes: 15 additions & 10 deletions packages/varlet-cli/template/create/[ComponentName].vue.ejs
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>

0 comments on commit 47e1019

Please sign in to comment.