feat(message): add Message component type definition and update the type annotation of the installation method (#3252)

This commit is contained in:
ajaxzheng 2025-04-07 17:05:58 +08:00 committed by GitHub
parent 5a670fbc7b
commit 8839fdcacb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 2 deletions

View File

@ -2,13 +2,27 @@ import Modal from '@opentiny/vue-modal'
import { extend } from '@opentiny/utils'
import { $prefix } from '@opentiny/vue-common'
import { version } from './package.json'
import type { ComponentPublicInstance } from '@opentiny/vue-common'
// 定义 Message 组件类型
interface MessageComponent extends ComponentPublicInstance {
name: string
version: string
install: (Vue: any) => void
componentName: string
}
// 定义 Vue 类型
interface VueConstructor {
component: (name: string, component: any) => void
}
const Message = extend(true, { props: { componentName: { type: String, default: 'Message' } } }, Modal, {
name: $prefix + 'Message'
})
}) as MessageComponent
/* istanbul ignore next */
Message.install = function (Vue) {
Message.install = function (Vue: VueConstructor) {
Vue.component(Message.name, Message)
}