refactor: reorganize all components (#8303)

This commit is contained in:
neverland
2021-03-08 11:50:37 +08:00
committed by GitHub
parent 3144a63d2b
commit e540876398
193 changed files with 1307 additions and 400 deletions
+5 -3
View File
@@ -1,4 +1,4 @@
import { PropType, reactive } from 'vue';
import { PropType, reactive, defineComponent } from 'vue';
// Utils
import { callInterceptor, Interceptor } from '../utils/interceptor';
@@ -12,7 +12,7 @@ import ActionBar from '../action-bar';
import ActionBarButton from '../action-bar-button';
import { popupSharedProps, popupSharedPropKeys } from '../popup/shared';
const [createComponent, bem, t] = createNamespace('dialog');
const [name, bem, t] = createNamespace('dialog');
export type DialogTheme = 'default' | 'round-button';
export type DialogAction = 'confirm' | 'cancel';
@@ -24,7 +24,9 @@ const popupKeys = [
'closeOnPopstate',
] as const;
export default createComponent({
export default defineComponent({
name,
props: {
...popupSharedProps,
title: String,
+4 -4
View File
@@ -1,5 +1,5 @@
import { App, Plugin, CSSProperties, TeleportProps } from 'vue';
import { inBrowser, ComponentInstance } from '../utils';
import { App, CSSProperties, TeleportProps } from 'vue';
import { inBrowser, ComponentInstance, installable } from '../utils';
import { Interceptor } from '../utils/interceptor';
import { mountComponent, usePopupState } from '../utils/mount-component';
import VanDialog, {
@@ -120,10 +120,10 @@ Dialog.resetDefaultOptions = () => {
};
Dialog.install = (app: App) => {
app.use((VanDialog as unknown) as Plugin);
app.use(installable(VanDialog));
app.config.globalProperties.$dialog = Dialog;
};
Dialog.Component = VanDialog;
Dialog.Component = installable(VanDialog);
export default Dialog;
+1 -1
View File
@@ -11,7 +11,7 @@ test('should update default options when calling setDefaultOptions method', () =
});
test('should expose Dialog component', () => {
expect(Dialog.Component).toEqual(DialogComponent);
expect(Dialog.Component.name).toEqual('van-dialog');
});
test('should register component to app', () => {