mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-05 19:41:42 +08:00
[improvement] entry file ts (#2802)
This commit is contained in:
parent
5c7c14d8df
commit
0ddafc77d8
@ -22,14 +22,21 @@ function buildVantEntry() {
|
||||
const exportList = Components.map(name => `${uppercamelize(name)}`);
|
||||
const intallList = exportList.filter(name => !~uninstallComponents.indexOf(uppercamelize(name)));
|
||||
const content = `${tips}
|
||||
import { VueConstructor } from 'vue/types';
|
||||
${importList.join('\n')}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
Vue?: VueConstructor;
|
||||
}
|
||||
}
|
||||
|
||||
const version = '${version}';
|
||||
const components = [
|
||||
${intallList.join(',\n ')}
|
||||
];
|
||||
|
||||
const install = Vue => {
|
||||
const install = (Vue: VueConstructor) => {
|
||||
components.forEach(Component => {
|
||||
Vue.use(Component);
|
||||
});
|
||||
@ -52,7 +59,7 @@ export default {
|
||||
};
|
||||
`;
|
||||
|
||||
fs.writeFileSync(path.join(__dirname, '../packages/index.js'), content);
|
||||
fs.writeFileSync(path.join(__dirname, '../packages/index.ts'), content);
|
||||
}
|
||||
|
||||
function buildDemoEntry() {
|
||||
|
@ -2,7 +2,7 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const excludes = [
|
||||
'index.js',
|
||||
'index.ts',
|
||||
'index.less',
|
||||
'style',
|
||||
'mixins',
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* eslint-disable */
|
||||
// This file is auto gererated by build/build-entry.js
|
||||
import { VueConstructor } from 'vue/types';
|
||||
import Actionsheet from './actionsheet';
|
||||
import AddressEdit from './address-edit';
|
||||
import AddressList from './address-list';
|
||||
@ -73,6 +74,12 @@ import TreeSelect from './tree-select';
|
||||
import Uploader from './uploader';
|
||||
import Waterfall from './waterfall';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
Vue?: VueConstructor;
|
||||
}
|
||||
}
|
||||
|
||||
const version = '1.6.5';
|
||||
const components = [
|
||||
Actionsheet,
|
||||
@ -146,7 +153,7 @@ const components = [
|
||||
Uploader
|
||||
];
|
||||
|
||||
const install = Vue => {
|
||||
const install = (Vue: VueConstructor) => {
|
||||
components.forEach(Component => {
|
||||
Vue.use(Component);
|
||||
});
|
2
types/component.d.ts
vendored
2
types/component.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue';
|
||||
|
||||
export class VanComponent {
|
||||
static name: string;
|
||||
|
4
types/index.d.ts
vendored
4
types/index.d.ts
vendored
@ -8,7 +8,7 @@ import { Lazyload } from './lazyload';
|
||||
import { Waterfall } from './waterfall';
|
||||
import { ImagePreview } from './image-preview';
|
||||
|
||||
export const version: string
|
||||
export const version: string;
|
||||
export function install (vue: typeof Vue): void
|
||||
export class Actionsheet extends VanComponent {}
|
||||
export class AddressEdit extends VanComponent {}
|
||||
@ -80,4 +80,4 @@ export {
|
||||
Lazyload,
|
||||
Waterfall,
|
||||
ImagePreview
|
||||
}
|
||||
};
|
||||
|
2
types/waterfall.d.ts
vendored
2
types/waterfall.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
import Vue, { DirectiveFunction, PluginFunction } from 'vue';
|
||||
import { DirectiveFunction, PluginFunction } from 'vue';
|
||||
|
||||
export interface Waterfall {
|
||||
(type: string): DirectiveFunction;
|
||||
|
Loading…
x
Reference in New Issue
Block a user