Skip to content

Commit 89688d5

Browse files
authored
feat(vue3): display functional tag (#1698)
1 parent 27d2b50 commit 89688d5

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

packages/app-backend-vue3/src/components/tree.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,15 @@ export class ComponentWalker {
145145
hasChildren: !!children.length,
146146
children: [],
147147
isFragment: isFragment(instance),
148-
tags: [],
148+
tags: typeof instance.type !== 'function'
149+
? []
150+
: [
151+
{
152+
label: 'functional',
153+
textColor: 0x555555,
154+
backgroundColor: 0xeeeeee,
155+
},
156+
],
149157
}
150158

151159
// capture children

packages/shell-dev-vue3/src/App.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import Ghost from './Ghost.vue'
1313
import Other from './Other.vue'
1414
import SetupRender from './SetupRender.js'
1515
import Form from './Form.vue'
16+
import Functional from './Functional.vue'
1617
import Heavy from './Heavy.vue'
1718
import Mixins from './Mixins.vue'
1819
import Animation from './Animation.vue'
@@ -42,6 +43,7 @@ export default {
4243
Other,
4344
SetupRender,
4445
Form,
46+
Functional,
4547
Heavy,
4648
Mixins,
4749
Animation,
@@ -104,6 +106,7 @@ export default {
104106
<Other />
105107
<SetupRender />
106108
<Form />
109+
<Functional msg="I am functional" />
107110
<Mixins />
108111
<SetupScript />
109112
<SetupDataLike />
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<script>
2+
import { h } from 'vue'
3+
4+
const Functional = (props, context) => {
5+
return h('div', context.attrs, props.msg)
6+
}
7+
Functional.props = {
8+
msg: {
9+
type: String,
10+
},
11+
}
12+
13+
export default Functional
14+
</script>

0 commit comments

Comments
 (0)