修改ts配置

This commit is contained in:
编码猿
2025-09-19 02:32:15 +08:00
parent 4e06a0caed
commit 05bcc3376c
4 changed files with 49 additions and 52 deletions

View File

@@ -1,6 +1,6 @@
import {Component, ComponentProps, Hook, useProps, VueComponent} from 'vue3-oop'
import {JSX} from "vue/jsx-runtime";
import {VNodeChild} from "vue";
import { Component, ComponentProps, Hook, useProps, VueComponent } from 'vue3-oop'
import { JSX } from "vue/jsx-runtime";
import { VNodeChild } from "vue";
interface ListItemType {
id: number
@@ -22,8 +22,8 @@ export default class Header extends VueComponent<HeaderProps> {
// required 的 true or false 需要和 类型中 text的? 对应
static defaultProps: ComponentProps<HeaderProps> = {
text: {default: '默认数值', required: true},
list: {default: () => []}
text: { default: '默认数值', required: true },
list: { default: () => [] }
};
@Hook('Mounted')
@@ -32,16 +32,15 @@ export default class Header extends VueComponent<HeaderProps> {
console.log('Header 组件的 mounted 生命周期...')
}
render() {
const {text, list} = useProps<HeaderProps>();
const { text, list } = useProps<HeaderProps>();
return (
<div class="header">
<p>{text}</p>
{this.context.slots.default?.()}
{this.context.slots.haveName?.()}
<p>{ text }</p>
{ this.context.slots.default?.() }
{ this.context.slots.haveName?.() }
<ul>
{
list.map(