How to get the value of the slot named body in tsx #6537
Unanswered
whyds000
asked this question in
Help/Questions
Replies: 1 comment
-
May be u can try this: App.tsx import { defineComponent } from 'vue'
import { Layout } from './Layout'
export const App = defineComponent({
setup() {
return () => (
<>
<Layout>
{{
default: () => 'this is default',
body: () => 'this is body'
}}
</Layout>
</>
)
}
})
Layout.tsx import { defineComponent } from 'vue'
export const Layout = defineComponent({
setup(props, { slots }) {
return () => (
<div>
<h1>{slots.default?.()}</h1>
<h2>{slots.body?.()}</h2>
</div>
)
}
})
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
import { defineComponent, ref } from "vue";
import styles from './ps.module.less'
interface _emit{
(e:'closePs'):void
}
export default defineComponent({
setup(props,{emit}:{emit:_emit}){
const ps=ref()
const editable=ref(true)
}
})
Beta Was this translation helpful? Give feedback.
All reactions