对比新文件 |
| | |
| | | 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> |
| | | ) |
| | | }, |
| | | }) |