chore: prefer named exports (#8315)

* chore: prefer named exports

* chore: fix import
This commit is contained in:
neverland 2021-03-09 15:39:26 +08:00 committed by GitHub
parent 5d5ff1da4a
commit 1381070a12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
171 changed files with 272 additions and 263 deletions

View File

@ -8,7 +8,7 @@ import { useExpose } from '../composables/use-expose';
import { useRoute, routeProps } from '../composables/use-route'; import { useRoute, routeProps } from '../composables/use-route';
// Components // Components
import Button, { ButtonType } from '../button'; import { Button, ButtonType } from '../button';
const [name, bem] = createNamespace('action-bar-button'); const [name, bem] = createNamespace('action-bar-button');

View File

@ -1,5 +1,5 @@
import { mount } from '../../../test'; import { mount } from '../../../test';
import ActionBarButton from '..'; import { ActionBarButton } from '..';
test('should render default slot correctly', () => { test('should render default slot correctly', () => {
const wrapper = mount(ActionBarButton, { const wrapper = mount(ActionBarButton, {

View File

@ -7,8 +7,8 @@ import { useParent } from '@vant/use';
import { useRoute, routeProps } from '../composables/use-route'; import { useRoute, routeProps } from '../composables/use-route';
// Components // Components
import Icon from '../icon'; import { Icon } from '../icon';
import Badge from '../badge'; import { Badge } from '../badge';
const [name, bem] = createNamespace('action-bar-icon'); const [name, bem] = createNamespace('action-bar-icon');

View File

@ -1,5 +1,5 @@
import { mount } from '../../../test'; import { mount } from '../../../test';
import ActionBarIcon from '..'; import { ActionBarIcon } from '..';
test('should render default slot correctly', () => { test('should render default slot correctly', () => {
const wrapper = mount(ActionBarIcon, { const wrapper = mount(ActionBarIcon, {

View File

@ -64,7 +64,7 @@
<script lang="ts"> <script lang="ts">
import { useTranslate } from '@demo/use-translate'; import { useTranslate } from '@demo/use-translate';
import Toast from '../../toast'; import { Toast } from '../../toast';
const i18n = { const i18n = {
'zh-CN': { 'zh-CN': {

View File

@ -1,4 +1,4 @@
import ActionBar from '..'; import { ActionBar } from '..';
import { mount } from '../../../test'; import { mount } from '../../../test';
test('should allow to disable safe-area-inset-bottom prop', () => { test('should allow to disable safe-area-inset-bottom prop', () => {

View File

@ -4,9 +4,9 @@ import { nextTick, PropType, defineComponent } from 'vue';
import { createNamespace, pick } from '../utils'; import { createNamespace, pick } from '../utils';
// Components // Components
import Icon from '../icon'; import { Icon } from '../icon';
import Popup from '../popup'; import { Popup } from '../popup';
import Loading from '../loading'; import { Loading } from '../loading';
import { popupSharedProps, popupSharedPropKeys } from '../popup/shared'; import { popupSharedProps, popupSharedPropKeys } from '../popup/shared';
const [name, bem] = createNamespace('action-sheet'); const [name, bem] = createNamespace('action-sheet');

View File

@ -55,7 +55,7 @@
import { computed, reactive, toRefs } from 'vue'; import { computed, reactive, toRefs } from 'vue';
import { useTranslate } from '@demo/use-translate'; import { useTranslate } from '@demo/use-translate';
import { ActionSheetAction } from '..'; import { ActionSheetAction } from '..';
import Toast from '../../toast'; import { Toast } from '../../toast';
const i18n = { const i18n = {
'zh-CN': { 'zh-CN': {

View File

@ -1,6 +1,6 @@
import { nextTick } from 'vue'; import { nextTick } from 'vue';
import { mount } from '../../../test'; import { mount } from '../../../test';
import ActionSheet from '..'; import { ActionSheet } from '..';
test('should emit select event after clicking option', async () => { test('should emit select event after clicking option', async () => {
const wrapper = mount(ActionSheet, { const wrapper = mount(ActionSheet, {

View File

@ -16,14 +16,14 @@ import { isMobile } from '../utils/validate/mobile';
import { useExpose } from '../composables/use-expose'; import { useExpose } from '../composables/use-expose';
// Components // Components
import Area, { AreaList, AreaColumnOption } from '../area'; import { Area, AreaList, AreaColumnOption } from '../area';
import Cell from '../cell'; import { Cell } from '../cell';
import Field from '../field'; import { Field } from '../field';
import Popup from '../popup'; import { Popup } from '../popup';
import Toast from '../toast'; import { Toast } from '../toast';
import Button from '../button'; import { Button } from '../button';
import Dialog from '../dialog'; import { Dialog } from '../dialog';
import Switch from '../switch'; import { Switch } from '../switch';
import AddressEditDetail, { AddressEditSearchItem } from './AddressEditDetail'; import AddressEditDetail, { AddressEditSearchItem } from './AddressEditDetail';
const [name, bem, t] = createNamespace('address-edit'); const [name, bem, t] = createNamespace('address-edit');

View File

@ -5,8 +5,8 @@ import { ComponentInstance, createNamespace } from '../utils';
import { isAndroid } from '../utils/validate/system'; import { isAndroid } from '../utils/validate/system';
// Components // Components
import Cell from '../cell'; import { Cell } from '../cell';
import Field from '../field'; import { Field } from '../field';
const [name, bem, t] = createNamespace('address-edit-detail'); const [name, bem, t] = createNamespace('address-edit-detail');
const android = isAndroid(); const android = isAndroid();

View File

@ -18,8 +18,8 @@
<script lang="ts"> <script lang="ts">
import { ref } from 'vue'; import { ref } from 'vue';
import { useTranslate } from '@demo/use-translate'; import { useTranslate } from '@demo/use-translate';
import Toast from '../../toast'; import { Toast } from '../../toast';
import areaList from '../../area/demo/area'; import { areaList } from '../../area/demo/area';
const i18n = { const i18n = {
'zh-CN': { 'zh-CN': {

View File

@ -1,5 +1,5 @@
import AddressEdit from '..'; import { AddressEdit } from '..';
import areaList from '../../area/demo/area-simple'; import { areaList } from '../../area/demo/area-simple';
import { mount, later, trigger } from '../../../test'; import { mount, later, trigger } from '../../../test';
const defaultAddressInfo = { const defaultAddressInfo = {

View File

@ -4,8 +4,8 @@ import { PropType, defineComponent } from 'vue';
import { createNamespace } from '../utils'; import { createNamespace } from '../utils';
// Components // Components
import Button from '../button'; import { Button } from '../button';
import RadioGroup from '../radio-group'; import { RadioGroup } from '../radio-group';
import AddressListItem, { AddressListAddress } from './AddressListItem'; import AddressListItem, { AddressListAddress } from './AddressListItem';
const [name, bem, t] = createNamespace('address-list'); const [name, bem, t] = createNamespace('address-list');
@ -68,7 +68,7 @@ export default defineComponent({
<AddressListItem <AddressListItem
v-slots={{ v-slots={{
bottom: slots['item-bottom'], bottom: slots['item-bottom'],
tag: slots['tag'], tag: slots.tag,
}} }}
key={item.id} key={item.id}
address={item} address={item}

View File

@ -4,10 +4,10 @@ import { PropType, defineComponent } from 'vue';
import { createNamespace } from '../utils'; import { createNamespace } from '../utils';
// Components // Components
import Tag from '../tag'; import { Tag } from '../tag';
import Icon from '../icon'; import { Icon } from '../icon';
import Cell from '../cell'; import { Cell } from '../cell';
import Radio from '../radio'; import { Radio } from '../radio';
const [name, bem] = createNamespace('address-item'); const [name, bem] = createNamespace('address-item');

View File

@ -15,7 +15,7 @@
<script lang="ts"> <script lang="ts">
import { ref } from 'vue'; import { ref } from 'vue';
import { useTranslate } from '@demo/use-translate'; import { useTranslate } from '@demo/use-translate';
import Toast from '../../toast'; import { Toast } from '../../toast';
const i18n = { const i18n = {
'zh-CN': { 'zh-CN': {

View File

@ -1,5 +1,5 @@
import { mount } from '../../../test'; import { mount } from '../../../test';
import AddressList from '..'; import { AddressList } from '..';
const list = [ const list = [
{ {

View File

@ -19,7 +19,7 @@ import { pickerProps } from '../picker/Picker';
import { useExpose } from '../composables/use-expose'; import { useExpose } from '../composables/use-expose';
// Components // Components
import Picker from '../picker'; import { Picker } from '../picker';
const [name, bem] = createNamespace('area'); const [name, bem] = createNamespace('area');

View File

@ -1,4 +1,4 @@
export default { export const areaListEn = {
province_list: { province_list: {
110000: 'Beijing', 110000: 'Beijing',
330000: 'Zhejiang', 330000: 'Zhejiang',

View File

@ -1,4 +1,4 @@
export default { export const areaList = {
province_list: { province_list: {
110000: '北京市', 110000: '北京市',
120000: '天津市', 120000: '天津市',

View File

@ -1,4 +1,4 @@
export default { export const areaList = {
province_list: { province_list: {
110000: '北京市', 110000: '北京市',
120000: '天津市', 120000: '天津市',

View File

@ -22,8 +22,8 @@
<script lang="ts"> <script lang="ts">
import { ref } from 'vue'; import { ref } from 'vue';
import AreaList from './area'; import { areaList } from './area';
import AreaListEn from './area-en'; import { areaListEn } from './area-en';
import { useTranslate } from '@demo/use-translate'; import { useTranslate } from '@demo/use-translate';
const i18n = { const i18n = {
@ -32,14 +32,14 @@ const i18n = {
title3: '配置显示列', title3: '配置显示列',
title4: '配置列占位提示文字', title4: '配置列占位提示文字',
columnsPlaceholder: ['请选择', '请选择', '请选择'], columnsPlaceholder: ['请选择', '请选择', '请选择'],
areaList: AreaList, areaList,
}, },
'en-US': { 'en-US': {
title2: 'Initial Value', title2: 'Initial Value',
title3: 'Columns Number', title3: 'Columns Number',
title4: 'Columns Placeholder', title4: 'Columns Placeholder',
columnsPlaceholder: ['Choose', 'Choose', 'Choose'], columnsPlaceholder: ['Choose', 'Choose', 'Choose'],
areaList: AreaListEn, areaList: areaListEn,
}, },
}; };

View File

@ -1,5 +1,5 @@
import Area from '..'; import { Area } from '..';
import areaList from '../demo/area-simple'; import { areaList } from '../demo/area-simple';
import { mount, later, triggerDrag } from '../../../test'; import { mount, later, triggerDrag } from '../../../test';
const firstOption = [ const firstOption = [

View File

@ -1,4 +1,4 @@
import Badge from '..'; import { Badge } from '..';
import { mount } from '../../../test'; import { mount } from '../../../test';
test('should render nothing when content is empty string', () => { test('should render nothing when content is empty string', () => {

View File

@ -11,8 +11,8 @@ import { BORDER_SURROUND } from '../utils/constant';
import { useRoute, routeProps } from '../composables/use-route'; import { useRoute, routeProps } from '../composables/use-route';
// Components // Components
import Icon from '../icon'; import { Icon } from '../icon';
import Loading, { LoadingType } from '../loading'; import { Loading, LoadingType } from '../loading';
const [name, bem] = createNamespace('button'); const [name, bem] = createNamespace('button');

View File

@ -1,5 +1,5 @@
import { mount } from '../../../test'; import { mount } from '../../../test';
import Button from '..'; import { Button } from '..';
test('should emit click event', () => { test('should emit click event', () => {
const wrapper = mount(Button); const wrapper = mount(Button);

View File

@ -31,9 +31,9 @@ import { useRefs } from '../composables/use-refs';
import { useExpose } from '../composables/use-expose'; import { useExpose } from '../composables/use-expose';
// Components // Components
import Popup, { PopupPosition } from '../popup'; import { Popup, PopupPosition } from '../popup';
import Button from '../button'; import { Button } from '../button';
import Toast from '../toast'; import { Toast } from '../toast';
import CalendarMonth, { CalendarType } from './CalendarMonth'; import CalendarMonth, { CalendarType } from './CalendarMonth';
import CalendarHeader from './CalendarHeader'; import CalendarHeader from './CalendarHeader';

View File

@ -1,4 +1,4 @@
import Calendar from '..'; import { Calendar } from '..';
import { mount, later } from '../../../test'; import { mount, later } from '../../../test';
import { getNextDay } from '../utils'; import { getNextDay } from '../utils';
import { import {

View File

@ -1,4 +1,4 @@
import Calendar from '..'; import { Calendar } from '..';
import { mount } from '../../../test'; import { mount } from '../../../test';
import { getNextDay, getPrevDay } from '../utils'; import { getNextDay, getPrevDay } from '../utils';
import { minDate, maxDate } from './utils'; import { minDate, maxDate } from './utils';

View File

@ -1,4 +1,4 @@
import Calendar from '..'; import { Calendar } from '..';
import { mount, later } from '../../../test'; import { mount, later } from '../../../test';
import { minDate, maxDate, formatRange, formatDate } from './utils'; import { minDate, maxDate, formatRange, formatDate } from './utils';

View File

@ -4,8 +4,8 @@ import { defineComponent } from 'vue';
import { createNamespace, isDef } from '../utils'; import { createNamespace, isDef } from '../utils';
// Components // Components
import Tag from '../tag'; import { Tag } from '../tag';
import Image from '../image'; import { Image } from '../image';
const [name, bem] = createNamespace('card'); const [name, bem] = createNamespace('card');

View File

@ -1,4 +1,4 @@
import Card from '..'; import { Card } from '..';
import { mount } from '../../../test'; import { mount } from '../../../test';
test('should emit click event after clicked', () => { test('should emit click event after clicked', () => {

View File

@ -2,9 +2,9 @@ import { nextTick, PropType, reactive, watch, defineComponent } from 'vue';
import { createNamespace } from '../utils'; import { createNamespace } from '../utils';
// Components // Components
import Tab from '../tab'; import { Tab } from '../tab';
import Tabs from '../tabs'; import { Tabs } from '../tabs';
import Icon from '../icon'; import { Icon } from '../icon';
const [name, bem, t] = createNamespace('cascader'); const [name, bem, t] = createNamespace('cascader');

View File

@ -1,6 +1,5 @@
import Cascader from '..'; import { Cascader } from '..';
import { mount, later } from '../../../test'; import { mount, later } from '../../../test';
import options from '../demo/area-en-US'; import options from '../demo/area-en-US';
test('should emit change event when active option changed', async () => { test('should emit change event when active option changed', async () => {

View File

@ -1,4 +1,4 @@
import CellGroup from '..'; import { CellGroup } from '..';
import { mount } from '../../../test'; import { mount } from '../../../test';
test('should render title slot correctly', () => { test('should render title slot correctly', () => {

View File

@ -7,7 +7,7 @@ import { createNamespace, isDef, UnknownProp } from '../utils';
import { useRoute, routeProps } from '../composables/use-route'; import { useRoute, routeProps } from '../composables/use-route';
// Components // Components
import Icon from '../icon'; import { Icon } from '../icon';
const [name, bem] = createNamespace('cell'); const [name, bem] = createNamespace('cell');

View File

@ -1,4 +1,4 @@
import Cell from '..'; import { Cell } from '..';
import { mount } from '../../../test'; import { mount } from '../../../test';
test('should render default slot correctly', () => { test('should render default slot correctly', () => {

View File

@ -1,7 +1,7 @@
import { ref, nextTick } from 'vue'; import { ref, nextTick } from 'vue';
import { mount } from '../../../test'; import { mount } from '../../../test';
import Checkbox from '../../checkbox'; import { Checkbox } from '../../checkbox';
import CheckboxGroup, { CheckboxGroupToggleAllOptions } from '..'; import { CheckboxGroup, CheckboxGroupToggleAllOptions } from '..';
test('should emit "update:modelValue" event when checkbox is clicked', async () => { test('should emit "update:modelValue" event when checkbox is clicked', async () => {
const wrapper = mount({ const wrapper = mount({

View File

@ -1,6 +1,6 @@
import { ref, computed, PropType, defineComponent } from 'vue'; import { ref, computed, PropType, defineComponent } from 'vue';
import { addUnit, UnknownProp } from '../utils'; import { addUnit, UnknownProp } from '../utils';
import Icon from '../icon'; import { Icon } from '../icon';
export type CheckerShape = 'square' | 'round'; export type CheckerShape = 'square' | 'round';
export type CheckerDirection = 'horizontal' | 'vertical'; export type CheckerDirection = 'horizontal' | 'vertical';

View File

@ -1,4 +1,4 @@
import Checkbox from '..'; import { Checkbox } from '..';
import { mount } from '../../../test'; import { mount } from '../../../test';
test('should emit "update:modelValue" event when checkbox icon is clicked', async () => { test('should emit "update:modelValue" event when checkbox icon is clicked', async () => {

View File

@ -1,4 +1,4 @@
import Circle from '..'; import { Circle } from '..';
import { mount, later } from '../../../test'; import { mount, later } from '../../../test';
// TODO // TODO

View File

@ -1,5 +1,5 @@
import Col from '..'; import { Col } from '..';
import Row from '../../row'; import { Row } from '../../row';
import { mount } from '../../../test'; import { mount } from '../../../test';
test('should render Col correcly', () => { test('should render Col correcly', () => {

View File

@ -11,7 +11,7 @@ import { useExpose } from '../composables/use-expose';
import { useLazyRender } from '../composables/use-lazy-render'; import { useLazyRender } from '../composables/use-lazy-render';
// Components // Components
import Cell from '../cell'; import { Cell } from '../cell';
const [name, bem] = createNamespace('collapse-item'); const [name, bem] = createNamespace('collapse-item');

View File

@ -1,6 +1,6 @@
import { defineComponent, ref } from 'vue'; import { defineComponent, ref } from 'vue';
import Collapse from '..'; import { Collapse } from '..';
import CollapseItem from '../../collapse-item'; import { CollapseItem } from '../../collapse-item';
import { later, mount } from '../../../test'; import { later, mount } from '../../../test';
const Component = defineComponent({ const Component = defineComponent({

View File

@ -1,6 +1,6 @@
import { PropType, defineComponent } from 'vue'; import { PropType, defineComponent } from 'vue';
import { createNamespace } from '../utils'; import { createNamespace } from '../utils';
import Cell from '../cell'; import { Cell } from '../cell';
const [name, bem, t] = createNamespace('contact-card'); const [name, bem, t] = createNamespace('contact-card');

View File

@ -25,7 +25,7 @@
<script lang="ts"> <script lang="ts">
import { computed } from 'vue'; import { computed } from 'vue';
import { useTranslate } from '@demo/use-translate'; import { useTranslate } from '@demo/use-translate';
import Toast from '../../toast'; import { Toast } from '../../toast';
const i18n = { const i18n = {
'zh-CN': { 'zh-CN': {

View File

@ -1,4 +1,4 @@
import ContactCard from '..'; import { ContactCard } from '..';
import { mount } from '../../../test'; import { mount } from '../../../test';
test('should emit click event when clicked', () => { test('should emit click event when clicked', () => {

View File

@ -5,12 +5,12 @@ import { createNamespace } from '../utils';
import { isMobile } from '../utils/validate/mobile'; import { isMobile } from '../utils/validate/mobile';
// Components // Components
import Cell from '../cell'; import { Cell } from '../cell';
import Form from '../form'; import { Form } from '../form';
import Field from '../field'; import { Field } from '../field';
import Button from '../button'; import { Button } from '../button';
import Dialog from '../dialog'; import { Dialog } from '../dialog';
import Switch from '../switch'; import { Switch } from '../switch';
const [name, bem, t] = createNamespace('contact-edit'); const [name, bem, t] = createNamespace('contact-edit');

View File

@ -14,7 +14,7 @@
<script lang="ts"> <script lang="ts">
import { ref } from 'vue'; import { ref } from 'vue';
import { useTranslate } from '@demo/use-translate'; import { useTranslate } from '@demo/use-translate';
import Toast from '../../toast'; import { Toast } from '../../toast';
const i18n = { const i18n = {
'zh-CN': { 'zh-CN': {

View File

@ -1,5 +1,5 @@
import { VueWrapper } from '@vue/test-utils'; import { VueWrapper } from '@vue/test-utils';
import ContactEdit, { ContactEditInfo } from '..'; import { ContactEdit, ContactEditInfo } from '..';
import { mount, later } from '../../../test'; import { mount, later } from '../../../test';
const contactInfo = { const contactInfo = {

View File

@ -5,12 +5,12 @@ import { createNamespace, UnknownProp } from '../utils';
import { RED } from '../utils/constant'; import { RED } from '../utils/constant';
// Components // Components
import Tag from '../tag'; import { Tag } from '../tag';
import Icon from '../icon'; import { Icon } from '../icon';
import Cell from '../cell'; import { Cell } from '../cell';
import Radio from '../radio'; import { Radio } from '../radio';
import Button from '../button'; import { Button } from '../button';
import RadioGroup from '../radio-group'; import { RadioGroup } from '../radio-group';
const [name, bem, t] = createNamespace('contact-list'); const [name, bem, t] = createNamespace('contact-list');

View File

@ -14,7 +14,7 @@
<script lang="ts"> <script lang="ts">
import { ref } from 'vue'; import { ref } from 'vue';
import { useTranslate } from '@demo/use-translate'; import { useTranslate } from '@demo/use-translate';
import Toast from '../../toast'; import { Toast } from '../../toast';
const i18n = { const i18n = {
'zh-CN': { 'zh-CN': {

View File

@ -1,4 +1,4 @@
import ContactList from '..'; import { ContactList } from '..';
import { mount } from '../../../test'; import { mount } from '../../../test';
const contactInfo = { const contactInfo = {

View File

@ -44,7 +44,7 @@
import { ref } from 'vue'; import { ref } from 'vue';
import { useTranslate } from '@demo/use-translate'; import { useTranslate } from '@demo/use-translate';
import { ComponentInstance } from '../../utils'; import { ComponentInstance } from '../../utils';
import Toast from '../../toast'; import { Toast } from '../../toast';
const i18n = { const i18n = {
'zh-CN': { 'zh-CN': {

View File

@ -1,5 +1,5 @@
import { KeepAlive, nextTick } from 'vue'; import { KeepAlive, nextTick } from 'vue';
import CountDown from '..'; import { CountDown } from '..';
import { mount, later } from '../../../test'; import { mount, later } from '../../../test';
test('should emit finish event when finished', async () => { test('should emit finish event when finished', async () => {

View File

@ -1,9 +1,13 @@
import { PropType, defineComponent } from 'vue'; import { PropType, defineComponent } from 'vue';
// Utils
import { isDef, createNamespace } from '../utils'; import { isDef, createNamespace } from '../utils';
import type { CouponInfo } from '../coupon';
// Components // Components
import Cell from '../cell'; import { Cell } from '../cell';
// Types
import type { CouponInfo } from '../coupon';
const [name, bem, t] = createNamespace('coupon-cell'); const [name, bem, t] = createNamespace('coupon-cell');

View File

@ -1,5 +1,5 @@
import { mount } from '../../../test'; import { mount } from '../../../test';
import CouponCell from '../index'; import { CouponCell } from '../index';
const coupon = { const coupon = {
id: 1, id: 1,

View File

@ -16,11 +16,11 @@ import { useWindowSize } from '@vant/use';
import { useRefs } from '../composables/use-refs'; import { useRefs } from '../composables/use-refs';
// Components // Components
import Tab from '../tab'; import { Tab } from '../tab';
import Tabs from '../tabs'; import { Tabs } from '../tabs';
import Field from '../field'; import { Field } from '../field';
import Button from '../button'; import { Button } from '../button';
import Coupon, { CouponInfo } from '../coupon'; import { Coupon, CouponInfo } from '../coupon';
const [name, bem, t] = createNamespace('coupon-list'); const [name, bem, t] = createNamespace('coupon-list');
const EMPTY_IMAGE = 'https://img.yzcdn.cn/vant/coupon-empty.png'; const EMPTY_IMAGE = 'https://img.yzcdn.cn/vant/coupon-empty.png';

View File

@ -27,7 +27,7 @@
import { computed, reactive, toRefs } from 'vue'; import { computed, reactive, toRefs } from 'vue';
import { useTranslate } from '@demo/use-translate'; import { useTranslate } from '@demo/use-translate';
import { CouponInfo } from '../../coupon'; import { CouponInfo } from '../../coupon';
import Toast from '../../toast'; import { Toast } from '../../toast';
const i18n = { const i18n = {
'zh-CN': { 'zh-CN': {

View File

@ -1,5 +1,5 @@
import { later, mount } from '../../../test'; import { later, mount } from '../../../test';
import CouponList from '..'; import { CouponList } from '..';
const coupon = { const coupon = {
id: 1, id: 1,

View File

@ -1,7 +1,7 @@
import { computed, PropType, defineComponent } from 'vue'; import { computed, PropType, defineComponent } from 'vue';
import { padZero, createNamespace } from '../utils'; import { padZero, createNamespace } from '../utils';
import { RED } from '../utils/constant'; import { RED } from '../utils/constant';
import Checkbox from '../checkbox'; import { Checkbox } from '../checkbox';
export type CouponInfo = { export type CouponInfo = {
id: string | number; id: string | number;

View File

@ -1,5 +1,5 @@
import { mount } from '../../../test'; import { mount } from '../../../test';
import Coupon from '..'; import { Coupon } from '..';
const coupon = { const coupon = {
id: 1, id: 1,

View File

@ -31,7 +31,7 @@ import {
import { useExpose } from '../composables/use-expose'; import { useExpose } from '../composables/use-expose';
// Components // Components
import Picker from '../picker'; import { Picker } from '../picker';
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const [name] = createNamespace('date-picker'); const [name] = createNamespace('date-picker');

View File

@ -21,7 +21,7 @@ import { times, sharedProps, pickerKeys } from './utils';
import { useExpose } from '../composables/use-expose'; import { useExpose } from '../composables/use-expose';
// Components // Components
import Picker from '../picker'; import { Picker } from '../picker';
const [name] = createNamespace('time-picker'); const [name] = createNamespace('time-picker');

View File

@ -1,4 +1,4 @@
import DatetimePicker from '..'; import { DatetimePicker } from '..';
import { mount } from '../../../test'; import { mount } from '../../../test';
test('confirm & cancel event', () => { test('confirm & cancel event', () => {

View File

@ -4,13 +4,13 @@ import { PropType, reactive, defineComponent } from 'vue';
import { callInterceptor, Interceptor } from '../utils/interceptor'; import { callInterceptor, Interceptor } from '../utils/interceptor';
import { createNamespace, addUnit, pick, UnknownProp } from '../utils'; import { createNamespace, addUnit, pick, UnknownProp } from '../utils';
import { BORDER_TOP, BORDER_LEFT } from '../utils/constant'; import { BORDER_TOP, BORDER_LEFT } from '../utils/constant';
import { popupSharedProps, popupSharedPropKeys } from '../popup/shared';
// Components // Components
import Popup from '../popup'; import { Popup } from '../popup';
import Button from '../button'; import { Button } from '../button';
import ActionBar from '../action-bar'; import { ActionBar } from '../action-bar';
import ActionBarButton from '../action-bar-button'; import { ActionBarButton } from '../action-bar-button';
import { popupSharedProps, popupSharedPropKeys } from '../popup/shared';
const [name, bem, t] = createNamespace('dialog'); const [name, bem, t] = createNamespace('dialog');

View File

@ -30,7 +30,7 @@
<script lang="ts"> <script lang="ts">
import { ref } from 'vue'; import { ref } from 'vue';
import { useTranslate } from '@demo/use-translate'; import { useTranslate } from '@demo/use-translate';
import Dialog from '..'; import { Dialog } from '..';
import type { DialogAction } from '../Dialog'; import type { DialogAction } from '../Dialog';
const i18n = { const i18n = {

View File

@ -1,6 +1,6 @@
import { createApp } from 'vue'; import { createApp } from 'vue';
import { later } from '../../../test'; import { later } from '../../../test';
import Dialog from '..'; import { Dialog } from '..';
import DialogComponent from '../Dialog'; import DialogComponent from '../Dialog';
test('should update default options when calling setDefaultOptions method', () => { test('should update default options when calling setDefaultOptions method', () => {

View File

@ -19,9 +19,9 @@ import { useParent } from '@vant/use';
import { useExpose } from '../composables/use-expose'; import { useExpose } from '../composables/use-expose';
// Components // Components
import Cell from '../cell'; import { Cell } from '../cell';
import Icon from '../icon'; import { Icon } from '../icon';
import Popup from '../popup'; import { Popup } from '../popup';
const [name, bem] = createNamespace('dropdown-item'); const [name, bem] = createNamespace('dropdown-item');

View File

@ -1,4 +1,4 @@
import Empty from '..'; import { Empty } from '..';
import { mount } from '../../../test'; import { mount } from '../../../test';
test('should render image slot correctly', () => { test('should render image slot correctly', () => {

View File

@ -37,8 +37,8 @@ import { useExpose } from '../composables/use-expose';
import { FORM_KEY, FIELD_KEY } from '../composables/use-link-field'; import { FORM_KEY, FIELD_KEY } from '../composables/use-link-field';
// Components // Components
import Icon from '../icon'; import { Icon } from '../icon';
import Cell from '../cell'; import { Cell } from '../cell';
// Types // Types
import type { import type {

View File

@ -1,4 +1,4 @@
import Field from '..'; import { Field } from '..';
import { mount } from '../../../test'; import { mount } from '../../../test';
test('should emit "update:modelValue" event when after inputing', () => { test('should emit "update:modelValue" event when after inputing', () => {

View File

@ -21,18 +21,18 @@
import { reactive, toRefs } from 'vue'; import { reactive, toRefs } from 'vue';
import { useTranslate } from '@demo/use-translate'; import { useTranslate } from '@demo/use-translate';
import { AreaColumnOption } from '../../area'; import { AreaColumnOption } from '../../area';
import AreaList from '../../area/demo/area'; import { areaList } from '../../area/demo/area';
import AreaListEn from '../../area/demo/area-en'; import { areaListEn } from '../../area/demo/area-en';
const i18n = { const i18n = {
'zh-CN': { 'zh-CN': {
picker: '地区选择', picker: '地区选择',
areaList: AreaList, areaList,
placeholder: '点击选择省市区', placeholder: '点击选择省市区',
}, },
'en-US': { 'en-US': {
picker: 'Area Picker', picker: 'Area Picker',
areaList: AreaListEn, areaList: areaListEn,
placeholder: 'Select area', placeholder: 'Select area',
}, },
}; };

View File

@ -42,7 +42,7 @@
import { reactive, toRefs } from 'vue'; import { reactive, toRefs } from 'vue';
import { useTranslate } from '@demo/use-translate'; import { useTranslate } from '@demo/use-translate';
import { FieldValidateError } from '../../field/types'; import { FieldValidateError } from '../../field/types';
import Toast from '../../toast'; import { Toast } from '../../toast';
const i18n = { const i18n = {
'zh-CN': { 'zh-CN': {

View File

@ -10,8 +10,8 @@ import { useParent } from '@vant/use';
import { useRoute, routeProps } from '../composables/use-route'; import { useRoute, routeProps } from '../composables/use-route';
// Components // Components
import Icon from '../icon'; import { Icon } from '../icon';
import Badge from '../badge'; import { Badge } from '../badge';
const [name, bem] = createNamespace('grid-item'); const [name, bem] = createNamespace('grid-item');

View File

@ -1,6 +1,6 @@
import { mount } from '../../../test'; import { mount } from '../../../test';
import Grid from '..'; import { Grid } from '..';
import GridItem from '../../grid-item'; import { GridItem } from '../../grid-item';
test('should render square grid with gutter correctly', () => { test('should render square grid with gutter correctly', () => {
const wrapper = mount({ const wrapper = mount({

View File

@ -1,6 +1,6 @@
import { PropType, defineComponent } from 'vue'; import { PropType, defineComponent } from 'vue';
import { addUnit, createNamespace } from '../utils'; import { addUnit, createNamespace } from '../utils';
import Badge from '../badge'; import { Badge } from '../badge';
const [name, bem] = createNamespace('icon'); const [name, bem] = createNamespace('icon');

View File

@ -98,7 +98,7 @@ import icons from '@vant/icons';
import { ref } from 'vue'; import { ref } from 'vue';
import { useTranslate } from '@demo/use-translate'; import { useTranslate } from '@demo/use-translate';
import { RED } from '../../utils/constant'; import { RED } from '../../utils/constant';
import Notify from '../../notify'; import { Notify } from '../../notify';
// from https://30secondsofcode.org // from https://30secondsofcode.org
function copyToClipboard(str: string) { function copyToClipboard(str: string) {

View File

@ -1,4 +1,4 @@
import Icon from '..'; import { Icon } from '..';
import { mount } from '../../../test'; import { mount } from '../../../test';
test('should render icon with builtin icon name correctly', () => { test('should render icon with builtin icon name correctly', () => {

View File

@ -23,9 +23,9 @@ import { useWindowSize } from '@vant/use';
import { useExpose } from '../composables/use-expose'; import { useExpose } from '../composables/use-expose';
// Components // Components
import Icon from '../icon'; import { Icon } from '../icon';
import Swipe, { SwipeToOptions } from '../swipe'; import { Swipe, SwipeToOptions } from '../swipe';
import Popup, { PopupCloseIconPosition } from '../popup'; import { Popup, PopupCloseIconPosition } from '../popup';
import ImagePreviewItem from './ImagePreviewItem'; import ImagePreviewItem from './ImagePreviewItem';
const [name, bem] = createNamespace('image-preview'); const [name, bem] = createNamespace('image-preview');

View File

@ -6,10 +6,10 @@ import { range, preventDefault, createNamespace } from '../utils';
// Composables // Composables
import { useTouch } from '../composables/use-touch'; import { useTouch } from '../composables/use-touch';
// Component // Components
import Image from '../image'; import { Image } from '../image';
import Loading from '../loading'; import { Loading } from '../loading';
import SwipeItem from '../swipe-item'; import { SwipeItem } from '../swipe-item';
function getDistance(touches: TouchList) { function getDistance(touches: TouchList) {
return Math.sqrt( return Math.sqrt(

View File

@ -36,8 +36,8 @@
<script lang="ts"> <script lang="ts">
import { reactive, toRefs } from 'vue'; import { reactive, toRefs } from 'vue';
import { useTranslate } from '@demo/use-translate'; import { useTranslate } from '@demo/use-translate';
import ImagePreview, { ImagePreviewOptions } from '..'; import { ImagePreview, ImagePreviewOptions } from '..';
import Toast from '../../toast'; import { Toast } from '../../toast';
const i18n = { const i18n = {
'zh-CN': { 'zh-CN': {

View File

@ -1,5 +1,5 @@
import { createApp } from 'vue'; import { createApp } from 'vue';
import ImagePreview from '..'; import { ImagePreview } from '..';
import ImagePreviewComponent from '../ImagePreview'; import ImagePreviewComponent from '../ImagePreview';
test('should expose ImagePreviewComponent in ImagePreview.Component', () => { test('should expose ImagePreviewComponent in ImagePreview.Component', () => {

View File

@ -1,14 +1,14 @@
import { nextTick } from 'vue';
import { DOMWrapper } from '@vue/test-utils/dist/domWrapper';
import { import {
mount, mount,
later, later,
trigger,
triggerDrag, triggerDrag,
mockGetBoundingClientRect, mockGetBoundingClientRect,
trigger,
} from '../../../test'; } from '../../../test';
import { ImagePreview } from '..';
import ImagePreviewComponent from '../ImagePreview'; import ImagePreviewComponent from '../ImagePreview';
import ImagePreview from '..';
import { nextTick } from 'vue';
import { DOMWrapper } from '@vue/test-utils/dist/domWrapper';
const images = [ const images = [
'https://img.yzcdn.cn/1.png', 'https://img.yzcdn.cn/1.png',

View File

@ -1,3 +1,4 @@
// Utils
import { import {
ref, ref,
watch, watch,
@ -15,7 +16,9 @@ import {
createNamespace, createNamespace,
ComponentInstance, ComponentInstance,
} from '../utils'; } from '../utils';
import Icon from '../icon';
// Components
import { Icon } from '../icon';
const [name, bem] = createNamespace('image'); const [name, bem] = createNamespace('image');

View File

@ -1,6 +1,6 @@
import { mount } from '../../../test'; import { mount } from '../../../test';
import { Lazyload } from '../../lazyload';
import VanImage from '..'; import VanImage from '..';
import Lazyload from '../../lazyload';
const IMAGE_URL = 'https://img.com'; const IMAGE_URL = 'https://img.com';

View File

@ -1,4 +1,4 @@
import { nextTick, onMounted, ref } from 'vue'; import { ref, nextTick, onMounted } from 'vue';
import { import {
mount, mount,
trigger, trigger,
@ -6,8 +6,8 @@ import {
mockScrollTop, mockScrollTop,
mockScrollIntoView, mockScrollIntoView,
} from '../../../test'; } from '../../../test';
import IndexBar from '..'; import { IndexBar } from '..';
import IndexAnchor from '../../index-anchor'; import { IndexAnchor } from '../../index-anchor';
test('should allow to custom anchor content', () => { test('should allow to custom anchor content', () => {
const wrapper = mount({ const wrapper = mount({

View File

@ -1,3 +1,4 @@
import { Lazyload } from '@vant/lazyload'; import { Lazyload } from '@vant/lazyload';
export default Lazyload; export default Lazyload;
export { Lazyload };

View File

@ -16,7 +16,7 @@ import { useRect, useScrollParent, useEventListener } from '@vant/use';
import { useExpose } from '../composables/use-expose'; import { useExpose } from '../composables/use-expose';
// Components // Components
import Loading from '../loading'; import { Loading } from '../loading';
const [name, bem, t] = createNamespace('list'); const [name, bem, t] = createNamespace('list');

View File

@ -1,4 +1,4 @@
import List from '..'; import { List } from '..';
import { mount, later, mockGetBoundingClientRect } from '../../../test'; import { mount, later, mockGetBoundingClientRect } from '../../../test';
test('should emit load event when reaching bottom', async () => { test('should emit load event when reaching bottom', async () => {

View File

@ -1,5 +1,5 @@
import { mount } from '../../../test'; import { mount } from '../../../test';
import Loading from '..'; import { Loading } from '..';
test('should change loading size when using size prop', () => { test('should change loading size when using size prop', () => {
const wrapper = mount(Loading, { const wrapper = mount(Loading, {

View File

@ -8,7 +8,7 @@ import { BORDER_BOTTOM } from '../utils/constant';
import { usePlaceholder } from '../composables/use-placeholder'; import { usePlaceholder } from '../composables/use-placeholder';
// Components // Components
import Icon from '../icon'; import { Icon } from '../icon';
const [name, bem] = createNamespace('nav-bar'); const [name, bem] = createNamespace('nav-bar');

View File

@ -21,7 +21,7 @@
<script lang="ts"> <script lang="ts">
import { useTranslate } from '@demo/use-translate'; import { useTranslate } from '@demo/use-translate';
import Toast from '../../toast'; import { Toast } from '../../toast';
const i18n = { const i18n = {
'zh-CN': { 'zh-CN': {

View File

@ -1,4 +1,4 @@
import NavBar from '..'; import { NavBar } from '..';
import { mount, mockGetBoundingClientRect, later } from '../../../test'; import { mount, mockGetBoundingClientRect, later } from '../../../test';
test('should render left slot correctly', () => { test('should render left slot correctly', () => {

View File

@ -1,4 +1,6 @@
import { ref, watch, reactive, PropType, defineComponent } from 'vue'; import { ref, watch, reactive, PropType, defineComponent } from 'vue';
// Utils
import { isDef, createNamespace } from '../utils'; import { isDef, createNamespace } from '../utils';
// Composables // Composables
@ -11,7 +13,7 @@ import {
} from '@vant/use'; } from '@vant/use';
// Components // Components
import Icon from '../icon'; import { Icon } from '../icon';
export type NoticeBarMode = 'closeable' | 'link'; export type NoticeBarMode = 'closeable' | 'link';

View File

@ -1,4 +1,4 @@
import NoticeBar from '..'; import { NoticeBar } from '..';
import { mount, later } from '../../../test'; import { mount, later } from '../../../test';
test('should emit close event when close icon is clicked', () => { test('should emit close event when close icon is clicked', () => {

View File

@ -1,6 +1,6 @@
import { PropType, defineComponent } from 'vue'; import { PropType, defineComponent } from 'vue';
import { createNamespace, UnknownProp } from '../utils'; import { createNamespace, UnknownProp } from '../utils';
import Popup from '../popup'; import { Popup } from '../popup';
import { popupSharedProps } from '../popup/shared'; import { popupSharedProps } from '../popup/shared';
const [name, bem] = createNamespace('notify'); const [name, bem] = createNamespace('notify');

View File

@ -32,7 +32,7 @@
<script lang="ts"> <script lang="ts">
import { ref } from 'vue'; import { ref } from 'vue';
import { useTranslate } from '@demo/use-translate'; import { useTranslate } from '@demo/use-translate';
import Notify from '..'; import { Notify } from '..';
import { NotifyType } from '../Notify'; import { NotifyType } from '../Notify';
const i18n = { const i18n = {

View File

@ -1,8 +1,8 @@
import { createApp } from 'vue'; import { createApp } from 'vue';
import Notify from '..';
import NotifyComponent from '../Notify';
import { later } from '../../../test'; import { later } from '../../../test';
import { trigger } from '../../utils'; import { trigger } from '../../utils';
import { Notify } from '..';
import NotifyComponent from '../Notify';
test('should not throw error if calling clear method before render notify', () => { test('should not throw error if calling clear method before render notify', () => {
Notify.clear(); Notify.clear();

View File

@ -1,7 +1,7 @@
import { ref, PropType, defineComponent } from 'vue'; import { ref, PropType, defineComponent } from 'vue';
import { createNamespace } from '../utils'; import { createNamespace } from '../utils';
import { useTouch } from '../composables/use-touch'; import { useTouch } from '../composables/use-touch';
import Loading from '../loading'; import { Loading } from '../loading';
const [name, bem] = createNamespace('key'); const [name, bem] = createNamespace('key');

Some files were not shown because too many files have changed in this diff Show More