Skip to content

Commit eb5ee01

Browse files
committed
chore: update playground
1 parent 1183494 commit eb5ee01

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Anthony Fu <https://github.com/zhiyuanzmj>
3+
Copyright (c) 2021 zhiyuanzmj <https://github.com/zhiyuanzmj>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

playground/slot.vue

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,36 @@
11
<script lang="tsx">
2-
import { defineComponent } from 'vue'
2+
import { defineComponent, ref } from 'vue'
33
44
const Comp = (props, { slots }) => (
5-
<>{slots.default ? <slots.default /> : <div>default slot</div>}</>
5+
<>
6+
{slots.default ? (
7+
<slots.default foo={props.foo} />
8+
) : (
9+
<div>default slot</div>
10+
)}
11+
</>
612
)
713
8-
let slots = { default: () => <div>foo</div> }
14+
let slots = {
15+
default: (scope) => <div>{scope.foo}</div>,
16+
}
917
1018
export default defineComponent({
1119
setup(props) {
12-
return <Comp v-slots={slots}></Comp>
20+
const foo = ref('foo')
21+
return (
22+
<>
23+
<input
24+
value={foo.value}
25+
onInput={(e) => (foo.value = e.target.value)}
26+
/>
27+
<Comp v-slots={slots} foo={foo.value} />
28+
<Comp
29+
v-slots={{ default: ({ foo }) => <div>{foo}</div> }}
30+
foo={foo.value}
31+
/>
32+
</>
33+
)
1334
},
1435
})
1536
</script>

0 commit comments

Comments
 (0)