fix: some components miss install type (#1547)

* fix: some components miss install type

* fix: some components miss install type
This commit is contained in:
qiang
2021-03-09 21:24:22 +08:00
committed by GitHub
parent a382e3f657
commit 272b8c76c8
14 changed files with 87 additions and 58 deletions

View File

@@ -1,8 +1,10 @@
import { App } from 'vue'
import Col from './src/col'
import type { SFCWithInstall } from '@element-plus/utils/types'
Col.install = (app: App): void => {
app.component(Col.name, Col)
const _Col: SFCWithInstall<typeof Col> = Col as SFCWithInstall<typeof Col>
_Col.install = app => {
app.component(_Col.name, _Col)
}
export default Col
export default _Col

View File

@@ -1,8 +1,11 @@
import { App } from 'vue'
import DatePicker from './src/date-picker'
import type { SFCWithInstall } from '@element-plus/utils/types'
DatePicker.install = (app: App): void => {
app.component(DatePicker.name, DatePicker)
const _DatePicker: SFCWithInstall<typeof DatePicker> = DatePicker as SFCWithInstall<typeof DatePicker>
_DatePicker.install = app => {
app.component(_DatePicker.name, _DatePicker)
}
export default DatePicker
export default _DatePicker

View File

@@ -98,9 +98,17 @@ import { setConfig } from '@element-plus/utils/config'
import isServer from '@element-plus/utils/isServer'
import dayjs from 'dayjs'
type DWindow = Window & typeof globalThis & {
dayjs?: typeof dayjs
}
// expose Day.js to window to make full bundle i18n work
if (!isServer && !(window as any).dayjs) {
(window as any).dayjs = dayjs
if (!isServer) {
const _window: DWindow = window
if (!_window.dayjs) {
_window.dayjs = dayjs
}
}
const version = version_ // version_ to fix tsc issue
@@ -222,7 +230,7 @@ const install = (app: App, opt: InstallOptions): void => {
})
plugins.forEach(plugin => {
app.use(plugin as any)
app.use(plugin)
})
}

View File

@@ -1,8 +1,10 @@
import { App } from 'vue'
import InfiniteScroll from './src/index'
import type { SFCWithInstall } from '@element-plus/utils/types'
(InfiniteScroll as any).install = (app: App): void => {
app.directive('InfiniteScroll', InfiniteScroll)
const _InfiniteScroll: SFCWithInstall<typeof InfiniteScroll> = InfiniteScroll as SFCWithInstall<typeof InfiniteScroll>
_InfiniteScroll.install = app => {
app.directive('InfiniteScroll', _InfiniteScroll)
}
export default InfiniteScroll
export default _InfiniteScroll

View File

@@ -1,12 +1,14 @@
import { App } from 'vue'
import MessageBox from './src/messageBox'
import type { SFCWithInstall } from '@element-plus/utils/types'
(MessageBox as any).install = (app: App): void => {
app.config.globalProperties.$msgbox = MessageBox
app.config.globalProperties.$messageBox = MessageBox
app.config.globalProperties.$alert = MessageBox.alert
app.config.globalProperties.$confirm = MessageBox.confirm
app.config.globalProperties.$prompt = MessageBox.prompt
const _MessageBox: SFCWithInstall<typeof MessageBox> = MessageBox as SFCWithInstall<typeof MessageBox>
_MessageBox.install = app => {
app.config.globalProperties.$msgbox = _MessageBox
app.config.globalProperties.$messageBox = _MessageBox
app.config.globalProperties.$alert = _MessageBox.alert
app.config.globalProperties.$confirm = _MessageBox.confirm
app.config.globalProperties.$prompt = _MessageBox.prompt
}
export default MessageBox
export default _MessageBox

View File

@@ -1,8 +1,10 @@
import { App } from 'vue'
import Message from './src/message'
import type { SFCWithInstall } from '@element-plus/utils/types'
(Message as any).install = (app: App): void => {
app.config.globalProperties.$message = Message
const _Message: SFCWithInstall<typeof Message> = Message as SFCWithInstall<typeof Message>
_Message.install = app => {
app.config.globalProperties.$message = _Message
}
export default Message
export default _Message

View File

@@ -1,8 +1,10 @@
import { App } from 'vue'
import Notify from './src/notify'
import type { SFCWithInstall } from '@element-plus/utils/types'
(Notify as any).install = (app: App): void => {
app.config.globalProperties.$notify = Notify
const _Notify: SFCWithInstall<typeof Notify> = Notify as SFCWithInstall<typeof Notify>
_Notify.install = app => {
app.config.globalProperties.$notify = _Notify
}
export default Notify
export default _Notify

View File

@@ -1,8 +1,10 @@
import { App } from 'vue'
import { Option } from '@element-plus/select'
import type { SFCWithInstall } from '@element-plus/utils/types'
Option.install = (app: App): void => {
app.component(Option.name, Option)
const _Option: SFCWithInstall<typeof Option> = Option as SFCWithInstall<typeof Option>
_Option.install = app => {
app.component(_Option.name, _Option)
}
export default Option
export default _Option

View File

@@ -1,9 +1,10 @@
import { App } from 'vue'
import Pagination from './src/index'
import type { SFCWithInstall } from '@element-plus/utils/types'
Pagination.install = (app: App): void => {
app.component(Pagination.name, Pagination)
const _Pagination: SFCWithInstall<typeof Pagination> = Pagination as SFCWithInstall<typeof Pagination>
_Pagination.install = app => {
app.component(_Pagination.name, _Pagination)
}
export default Pagination
export default _Pagination

View File

@@ -1,8 +1,10 @@
import { App } from 'vue'
import Row from '../col/src/row'
import type { SFCWithInstall } from '@element-plus/utils/types'
Row.install = (app: App): void => {
app.component(Row.name, Row)
const _Row: SFCWithInstall<typeof Row> = Row as SFCWithInstall<typeof Row>
_Row.install = app => {
app.component(_Row.name, _Row)
}
export default Row
export default _Row

View File

@@ -1,11 +1,10 @@
import { App } from 'vue'
import Space from './src/index'
import type { SFCWithInstall } from '@element-plus/utils/types'
Space.install = (app: App): void => {
app.component(Space.name, Space)
const _Space: SFCWithInstall<typeof Space> = Space as SFCWithInstall<typeof Space>
_Space.install = app => {
app.component(_Space.name, _Space)
}
const _Space: SFCWithInstall<typeof Space> = Space as any
export default _Space

View File

@@ -1,8 +1,10 @@
import { App } from 'vue'
import TableColumn from '../table/src/tableColumn'
import type { SFCWithInstall } from '@element-plus/utils/types'
TableColumn.install = (app: App): void => {
app.component(TableColumn.name, TableColumn)
const _TableColumn: SFCWithInstall<typeof TableColumn> = TableColumn as SFCWithInstall<typeof TableColumn>
_TableColumn.install = app => {
app.component(_TableColumn.name, _TableColumn)
}
export default TableColumn
export default _TableColumn

View File

@@ -1,14 +1,16 @@
import { App } from 'vue'
import TimePicker from './src/time-picker'
import CommonPicker from './src/common/picker.vue'
import TimePickPanel from './src/time-picker-com/panel-time-pick.vue'
import type { SFCWithInstall } from '@element-plus/utils/types'
export * from './src/common/date-utils'
export * from './src/common/constant'
export * from './src/common/props'
TimePicker.install = (app: App): void => {
app.component(TimePicker.name, TimePicker)
const _TimePicker: SFCWithInstall<typeof TimePicker> = TimePicker as SFCWithInstall<typeof TimePicker>
_TimePicker.install = app => {
app.component(_TimePicker.name, _TimePicker)
}
export { CommonPicker, TimePickPanel }
export default TimePicker
export default _TimePicker

View File

@@ -1,4 +1,4 @@
import { App } from 'vue'
import type { App } from 'vue'
type OptionalKeys<T extends Record<string, unknown>> = {
[K in keyof T]: T extends Record<K, T[K]>