Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions packages/vue/src/message/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
Loading