@tslib/vue-ext
Advanced tools
Comparing version 1.0.16 to 1.0.17
@@ -1,4 +0,3 @@ | ||
import Vue, { FunctionalComponentOptions } from "vue"; | ||
import Vue from "vue"; | ||
import "vuex"; | ||
import { ComponentOptions, ThisTypedComponentOptionsWithArrayProps, RecordPropsDefinition, ThisTypedComponentOptionsWithRecordProps } from "vue/types/options"; | ||
export interface ExtOptions { | ||
@@ -14,14 +13,19 @@ module: string; | ||
import "./extTimer"; | ||
/** | ||
* 定义扩展方法 | ||
*/ | ||
export declare type FN_EXTERN = typeof Vue.extend; | ||
export declare function _extend(options: any): any; | ||
declare module "vue/types/vue" { | ||
interface VueConstructor<V extends Vue> { | ||
extend<Data, Methods, Computed, PropNames extends string = never>(options?: ThisTypedComponentOptionsWithArrayProps<V, Data, Methods, Computed, PropNames> & ExtOptions): ExtendedVue<V, Data, Methods, Computed, Record<PropNames, any>>; | ||
extend<Data, Methods, Computed, Props>(options?: ThisTypedComponentOptionsWithRecordProps<V, Data, Methods, Computed, Props> & ExtOptions): ExtendedVue<V, Data, Methods, Computed, Props>; | ||
extend<PropNames extends string = never>(definition: FunctionalComponentOptions<Record<PropNames, any>, PropNames[]> & ExtOptions): ExtendedVue<V, {}, {}, {}, Record<PropNames, any>>; | ||
extend<Props>(definition: FunctionalComponentOptions<Props, RecordPropsDefinition<Props>> & ExtOptions): ExtendedVue<V, {}, {}, {}, Props>; | ||
extendVue(options?: ExtOptions & ComponentOptions<V>): ExtendedVue<V, {}, {}, {}, {}>; | ||
interface VueConstructor { | ||
extendVue: FN_EXTERN; | ||
} | ||
} | ||
declare module "vue/types/options" { | ||
interface ComponentOptions<V extends Vue> { | ||
module?: string; | ||
index?: number; | ||
page?: string; | ||
icon?: string; | ||
timerInterval?: number; | ||
onTimer?: Function; | ||
} | ||
} | ||
export default Vue; |
@@ -14,21 +14,21 @@ "use strict"; | ||
exports.store = globalStore_2.store; | ||
_d("init vueExt..."); | ||
const a = {}; | ||
// 初始化定时器 | ||
require("./extTimer"); | ||
// 初始化vue扩展 | ||
vue_1.default.extendVue = function (options) { | ||
// 如果option中有page选项,则注册为page,否则注册为component | ||
const VueExt = vue_1.default.extend(options); | ||
if (options) { | ||
_d("init vueExt..."); | ||
function _extend(options) { | ||
const vue = vue_1.default.extend.apply(vue_1.default, arguments); | ||
if (options && options.module) { | ||
globalStore_1.store.commit(`registerVueComponents`, { | ||
module: options.module, | ||
name: options.name, | ||
components: VueExt, | ||
components: vue, | ||
page: options.page | ||
}); | ||
} | ||
return VueExt; | ||
}; | ||
return vue; | ||
} | ||
exports._extend = _extend; | ||
// 初始化vue扩展 | ||
vue_1.default.extendVue = _extend; | ||
exports.default = vue_1.default; | ||
//# sourceMappingURL=vueExt.js.map |
{ | ||
"name": "@tslib/vue-ext", | ||
"version": "1.0.16", | ||
"version": "1.0.17", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "config file loader for typescript", |
@@ -5,8 +5,2 @@ import Vue, { VueConstructor, FunctionalComponentOptions } from "vue"; | ||
import { ExtendedVue } from "vue/types/vue"; | ||
import { | ||
ComponentOptions, | ||
ThisTypedComponentOptionsWithArrayProps, | ||
RecordPropsDefinition, | ||
ThisTypedComponentOptionsWithRecordProps | ||
} from "vue/types/options"; | ||
@@ -28,68 +22,43 @@ import _ from "lodash"; | ||
export { store } from "./globalStore"; | ||
// 初始化定时器 | ||
import "./extTimer"; | ||
_d("init vueExt..."); | ||
const a = {} as ComponentOptions<Vue>; | ||
export type FN_EXTERN = typeof Vue.extend; | ||
export function _extend(options: any) { | ||
const vue = Vue.extend.apply(Vue, arguments); | ||
// 初始化定时器 | ||
import "./extTimer"; | ||
// 初始化vue扩展 | ||
Vue.extendVue = function(options?: ExtOptions & ComponentOptions<Vue>) { | ||
// 如果option中有page选项,则注册为page,否则注册为component | ||
const VueExt = Vue.extend(options); | ||
if (options) { | ||
if (options && options.module) { | ||
store.commit(`registerVueComponents`, { | ||
module: options.module, | ||
name: options.name, | ||
components: VueExt, | ||
components: vue, | ||
page: options.page | ||
}); | ||
} | ||
return VueExt; | ||
}; | ||
return vue; | ||
} | ||
// 初始化vue扩展 | ||
/** | ||
* 定义扩展方法 | ||
*/ | ||
Vue.extendVue = _extend as FN_EXTERN; | ||
declare module "vue/types/vue" { | ||
interface VueConstructor<V extends Vue> { | ||
extend<Data, Methods, Computed, PropNames extends string = never>( | ||
options?: ThisTypedComponentOptionsWithArrayProps< | ||
V, | ||
Data, | ||
Methods, | ||
Computed, | ||
PropNames | ||
> & | ||
ExtOptions | ||
): ExtendedVue<V, Data, Methods, Computed, Record<PropNames, any>>; | ||
extend<Data, Methods, Computed, Props>( | ||
options?: ThisTypedComponentOptionsWithRecordProps< | ||
V, | ||
Data, | ||
Methods, | ||
Computed, | ||
Props | ||
> & | ||
ExtOptions | ||
): ExtendedVue<V, Data, Methods, Computed, Props>; | ||
extend<PropNames extends string = never>( | ||
definition: FunctionalComponentOptions< | ||
Record<PropNames, any>, | ||
PropNames[] | ||
> & | ||
ExtOptions | ||
): ExtendedVue<V, {}, {}, {}, Record<PropNames, any>>; | ||
extend<Props>( | ||
definition: FunctionalComponentOptions< | ||
Props, | ||
RecordPropsDefinition<Props> | ||
> & | ||
ExtOptions | ||
): ExtendedVue<V, {}, {}, {}, Props>; | ||
extendVue( | ||
options?: ExtOptions & ComponentOptions<V> | ||
): ExtendedVue<V, {}, {}, {}, {}>; | ||
interface VueConstructor { | ||
extendVue: FN_EXTERN; | ||
} | ||
} | ||
declare module "vue/types/options" { | ||
interface ComponentOptions<V extends Vue> { | ||
module?: string; | ||
index?: number; | ||
page?: string; | ||
icon?: string; | ||
timerInterval?: number; | ||
onTimer?: Function; | ||
} | ||
} | ||
export default Vue; |
Sorry, the diff of this file is not supported yet
30117
384