Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyo930021 committed Oct 7, 2020
1 parent 8ee5f21 commit de719af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions server/src/services/typescriptService/preprocess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,13 @@ function convertChildComponentsInfoToSource(childComponents: ChildComponent[]) {

const propTypeStrings: string[] = [];
c.info?.componentInfo.props?.forEach(p => {
let typeKey = p.required ? kebabCase(p.name) : kebabCase(p.name) + '?';
if (typeKey.indexOf('-') !== -1) {
let typeKey = kebabCase(p.name);
if (typeKey.includes('-')) {
typeKey = `'` + typeKey + `'`;
}
if (!p.required) {
typeKey += '?';
}

if (p.typeString) {
propTypeStrings.push(`${typeKey}: ${p.typeString}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export default Vue.extend({
callback: {
type: Function as PropType<() => void>
},
arr: Array as PropType<string[]>
arr: Array as PropType<string[]>,
darkMode: { type: Boolean, default: false }
}
});
</script>

0 comments on commit de719af

Please sign in to comment.