1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
| import { defineComponent, SetupContext } from 'vue'
| import styles from './Title.module.scss'
|
| export default defineComponent({
| name: 'Title',
| emits: ['click'],
| props: {
| desc: {
| type: String,
| default: '',
| },
| top: {
| type: Number,
| default: 0,
| },
| bottom: {
| type: Number,
| default: 0,
| },
| },
| setup(props, { attrs, slots, emit }: SetupContext) {
| return () => (
| <h3
| style={{ margin: `${props.top}px 0 ${props.bottom}px 0` }}
| class={styles.title}
| onClick={() => emit('click')}
| >
| <span>{slots.default && slots.default()}</span>
| {slots.content ? (
| <span>{slots.content()}</span>
| ) : (
| <span class={styles.desc}>{props.desc}</span>
| )}
| </h3>
| )
| },
| })
|
|