mirror of
https://gitee.com/vant-contrib/vant.git
synced 2026-06-04 01:28:19 +08:00
Compare commits
No commits in common. "4f393c93a8d1a3ab983709fa52088fde13195175" and "4cf5a6ba0def1162de1ff9eb871d1e945d5a090c" have entirely different histories.
4f393c93a8
...
4cf5a6ba0d
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _ActionBarButton from './ActionBarButton';
|
||||
|
||||
export const ActionBarButton = withInstall(_ActionBarButton);
|
||||
const ActionBarButton = withInstall<typeof _ActionBarButton>(_ActionBarButton);
|
||||
|
||||
export default ActionBarButton;
|
||||
export { ActionBarButton };
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _ActionBarIcon from './ActionBarIcon';
|
||||
|
||||
export const ActionBarIcon = withInstall(_ActionBarIcon);
|
||||
const ActionBarIcon = withInstall<typeof _ActionBarIcon>(_ActionBarIcon);
|
||||
|
||||
export default ActionBarIcon;
|
||||
export { ActionBarIcon };
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _ActionBar from './ActionBar';
|
||||
|
||||
export const ActionBar = withInstall(_ActionBar);
|
||||
const ActionBar = withInstall<typeof _ActionBar>(_ActionBar);
|
||||
|
||||
export default ActionBar;
|
||||
export { ActionBar };
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _ActionSheet from './ActionSheet';
|
||||
|
||||
export const ActionSheet = withInstall(_ActionSheet);
|
||||
const ActionSheet = withInstall<typeof _ActionSheet>(_ActionSheet);
|
||||
|
||||
export default ActionSheet;
|
||||
export { ActionSheet };
|
||||
export type { ActionSheetAction } from './ActionSheet';
|
||||
|
||||
@ -41,7 +41,9 @@ export default defineComponent({
|
||||
emit('input', `${express.address || ''} ${express.name || ''}`.trim());
|
||||
};
|
||||
|
||||
const onFinish = () => field.value?.blur();
|
||||
const onFinish = () => {
|
||||
field.value!.blur();
|
||||
};
|
||||
|
||||
const renderFinish = () => {
|
||||
if (props.value && props.focused && android) {
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _AddressEdit from './AddressEdit';
|
||||
|
||||
export const AddressEdit = withInstall(_AddressEdit);
|
||||
const AddressEdit = withInstall<typeof _AddressEdit>(_AddressEdit);
|
||||
|
||||
export default AddressEdit;
|
||||
export { AddressEdit };
|
||||
export type {
|
||||
AddressEditInfo,
|
||||
AddressEditInstance,
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _AddressList from './AddressList';
|
||||
|
||||
export const AddressList = withInstall(_AddressList);
|
||||
const AddressList = withInstall<typeof _AddressList>(_AddressList);
|
||||
|
||||
export default AddressList;
|
||||
export { AddressList };
|
||||
export type { AddressListAddress } from './AddressListItem';
|
||||
|
||||
@ -285,10 +285,8 @@ export default defineComponent({
|
||||
state.code = values[index].code;
|
||||
setValues();
|
||||
|
||||
if (pickerRef.value) {
|
||||
const parsedValues = parseValues(pickerRef.value.getValues());
|
||||
emit('change', parsedValues, index);
|
||||
}
|
||||
const parsedValues = parseValues(pickerRef.value!.getValues());
|
||||
emit('change', parsedValues, index);
|
||||
};
|
||||
|
||||
const onConfirm = (values: AreaColumnOption[], index: number) => {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Area from './Area';
|
||||
|
||||
export const Area = withInstall(_Area);
|
||||
const Area = withInstall<typeof _Area>(_Area);
|
||||
|
||||
export default Area;
|
||||
export { Area };
|
||||
export type { AreaList, AreaInstance, AreaColumnOption } from './types';
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Badge from './Badge';
|
||||
|
||||
export const Badge = withInstall(_Badge);
|
||||
const Badge = withInstall<typeof _Badge>(_Badge);
|
||||
|
||||
export default Badge;
|
||||
export { Badge };
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Button from './Button';
|
||||
|
||||
export const Button = withInstall(_Button);
|
||||
const Button = withInstall<typeof _Button>(_Button);
|
||||
|
||||
export default Button;
|
||||
export { Button };
|
||||
export type { ButtonType, ButtonSize } from './Button';
|
||||
|
||||
@ -94,14 +94,12 @@ export default defineComponent({
|
||||
const scrollIntoView = (body: Element) => {
|
||||
const el = props.showSubtitle ? daysRef.value : monthRef.value;
|
||||
|
||||
if (el) {
|
||||
const scrollTop =
|
||||
el.getBoundingClientRect().top -
|
||||
body.getBoundingClientRect().top +
|
||||
body.scrollTop;
|
||||
const scrollTop =
|
||||
el!.getBoundingClientRect().top -
|
||||
body.getBoundingClientRect().top +
|
||||
body.scrollTop;
|
||||
|
||||
setScrollTop(body, scrollTop);
|
||||
}
|
||||
setScrollTop(body, scrollTop);
|
||||
};
|
||||
|
||||
const getMultipleDayType = (day: Date) => {
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Calendar from './Calendar';
|
||||
|
||||
export const Calendar = withInstall(_Calendar);
|
||||
const Calendar = withInstall<typeof _Calendar>(_Calendar);
|
||||
|
||||
export default Calendar;
|
||||
export { Calendar };
|
||||
export type {
|
||||
CalendarType,
|
||||
CalendarDayItem,
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Card from './Card';
|
||||
|
||||
export const Card = withInstall(_Card);
|
||||
const Card = withInstall<typeof _Card>(_Card);
|
||||
|
||||
export default Card;
|
||||
export { Card };
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Cascader from './Cascader';
|
||||
|
||||
export const Cascader = withInstall(_Cascader);
|
||||
const Cascader = withInstall<typeof _Cascader>(_Cascader);
|
||||
|
||||
export default Cascader;
|
||||
export { Cascader };
|
||||
export type { CascaderOption, CascaderFieldNames } from './Cascader';
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _CellGroup from './CellGroup';
|
||||
|
||||
export const CellGroup = withInstall(_CellGroup);
|
||||
const CellGroup = withInstall<typeof _CellGroup>(_CellGroup);
|
||||
|
||||
export default CellGroup;
|
||||
export { CellGroup };
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Cell from './Cell';
|
||||
|
||||
export const Cell = withInstall(_Cell);
|
||||
const Cell = withInstall<typeof _Cell>(_Cell);
|
||||
|
||||
export default Cell;
|
||||
export { Cell };
|
||||
export type { CellArrowDirection } from './Cell';
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _CheckboxGroup from './CheckboxGroup';
|
||||
|
||||
export const CheckboxGroup = withInstall(_CheckboxGroup);
|
||||
const CheckboxGroup = withInstall<typeof _CheckboxGroup>(_CheckboxGroup);
|
||||
|
||||
export default CheckboxGroup;
|
||||
export { CheckboxGroup };
|
||||
export type {
|
||||
CheckboxGroupInstance,
|
||||
CheckboxGroupToggleAllOptions,
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Checkbox from './Checkbox';
|
||||
|
||||
export const Checkbox = withInstall(_Checkbox);
|
||||
const Checkbox = withInstall<typeof _Checkbox>(_Checkbox);
|
||||
|
||||
export default Checkbox;
|
||||
export { Checkbox };
|
||||
export type { CheckboxInstance } from './types';
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Circle from './Circle';
|
||||
|
||||
export const Circle = withInstall(_Circle);
|
||||
const Circle = withInstall<typeof _Circle>(_Circle);
|
||||
|
||||
export default Circle;
|
||||
export { Circle };
|
||||
export type { CircleStartPosition } from './Circle';
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Col from './Col';
|
||||
|
||||
export const Col = withInstall(_Col);
|
||||
const Col = withInstall<typeof _Col>(_Col);
|
||||
|
||||
export default Col;
|
||||
export { Col };
|
||||
|
||||
@ -61,8 +61,8 @@ export default defineComponent({
|
||||
const onTransitionEnd = () => {
|
||||
if (!expanded.value) {
|
||||
show.value = false;
|
||||
} else if (wrapperRef.value) {
|
||||
wrapperRef.value.style.height = '';
|
||||
} else {
|
||||
wrapperRef.value!.style.height = '';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _CollapseItem from './CollapseItem';
|
||||
|
||||
export const CollapseItem = withInstall(_CollapseItem);
|
||||
const CollapseItem = withInstall<typeof _CollapseItem>(_CollapseItem);
|
||||
|
||||
export default CollapseItem;
|
||||
export { CollapseItem };
|
||||
export type { CollapseItemInstance } from './types';
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Collapse from './Collapse';
|
||||
|
||||
export const Collapse = withInstall(_Collapse);
|
||||
const Collapse = withInstall<typeof _Collapse>(_Collapse);
|
||||
|
||||
export default Collapse;
|
||||
export { Collapse };
|
||||
|
||||
@ -4,11 +4,11 @@ import { Ref, ref, onMounted, nextTick } from 'vue';
|
||||
export const useHeight = (element: Element | Ref<Element | undefined>) => {
|
||||
const height = ref<number>();
|
||||
|
||||
onMounted(() =>
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
height.value = useRect(element).height;
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
return height;
|
||||
};
|
||||
|
||||
@ -71,9 +71,17 @@ export function useLockScroll(
|
||||
}
|
||||
};
|
||||
|
||||
const init = () => shouldLock() && lock();
|
||||
const init = () => {
|
||||
if (shouldLock()) {
|
||||
lock();
|
||||
}
|
||||
};
|
||||
|
||||
const destroy = () => shouldLock() && unlock();
|
||||
const destroy = () => {
|
||||
if (shouldLock()) {
|
||||
unlock();
|
||||
}
|
||||
};
|
||||
|
||||
onMountedOrActivated(init);
|
||||
onDeactivated(destroy);
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _ConfigProvider from './ConfigProvider';
|
||||
|
||||
export const ConfigProvider = withInstall(_ConfigProvider);
|
||||
const ConfigProvider = withInstall<typeof _ConfigProvider>(_ConfigProvider);
|
||||
|
||||
export default ConfigProvider;
|
||||
export { ConfigProvider };
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _ContactCard from './ContactCard';
|
||||
|
||||
export const ContactCard = withInstall(_ContactCard);
|
||||
const ContactCard = withInstall<typeof _ContactCard>(_ContactCard);
|
||||
|
||||
export default ContactCard;
|
||||
export { ContactCard };
|
||||
export type { ContactCardType } from './ContactCard';
|
||||
|
||||
@ -54,10 +54,11 @@ export default defineComponent({
|
||||
}
|
||||
};
|
||||
|
||||
const onDelete = () =>
|
||||
const onDelete = () => {
|
||||
Dialog.confirm({
|
||||
title: t('confirmDelete'),
|
||||
}).then(() => emit('delete', contact));
|
||||
};
|
||||
|
||||
const renderButtons = () => (
|
||||
<div class={bem('buttons')}>
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _ContactEdit from './ContactEdit';
|
||||
|
||||
export const ContactEdit = withInstall(_ContactEdit);
|
||||
const ContactEdit = withInstall<typeof _ContactEdit>(_ContactEdit);
|
||||
|
||||
export default ContactEdit;
|
||||
export { ContactEdit };
|
||||
export type { ContactEditInfo } from './ContactEdit';
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _ContactList from './ContactList';
|
||||
|
||||
export const ContactList = withInstall(_ContactList);
|
||||
const ContactList = withInstall<typeof _ContactList>(_ContactList);
|
||||
|
||||
export default ContactList;
|
||||
export { ContactList };
|
||||
export type { ContactListItem } from './ContactList';
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _CountDown from './CountDown';
|
||||
|
||||
export const CountDown = withInstall(_CountDown);
|
||||
const CountDown = withInstall<typeof _CountDown>(_CountDown);
|
||||
|
||||
export default CountDown;
|
||||
export { CountDown };
|
||||
export type { CountDownInstance, CountDownCurrentTime } from './CountDown';
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _CouponCell from './CouponCell';
|
||||
|
||||
export const CouponCell = withInstall(_CouponCell);
|
||||
const CouponCell = withInstall<typeof _CouponCell>(_CouponCell);
|
||||
|
||||
export default CouponCell;
|
||||
export { CouponCell };
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _CouponList from './CouponList';
|
||||
|
||||
export const CouponList = withInstall(_CouponList);
|
||||
const CouponList = withInstall<typeof _CouponList>(_CouponList);
|
||||
|
||||
export default CouponList;
|
||||
export { CouponList };
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Coupon from './Coupon';
|
||||
|
||||
export const Coupon = withInstall(_Coupon);
|
||||
const Coupon = withInstall<typeof _Coupon>(_Coupon);
|
||||
|
||||
export default Coupon;
|
||||
export { Coupon };
|
||||
export type { CouponInfo } from './Coupon';
|
||||
|
||||
@ -222,7 +222,7 @@ export default defineComponent({
|
||||
});
|
||||
|
||||
nextTick(() => {
|
||||
picker.value?.setValues(values);
|
||||
picker.value!.setValues(values);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -106,7 +106,7 @@ export default defineComponent({
|
||||
];
|
||||
|
||||
nextTick(() => {
|
||||
picker.value?.setValues(values);
|
||||
picker.value!.setValues(values);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _DatetimePicker from './DatetimePicker';
|
||||
|
||||
export const DatetimePicker = withInstall(_DatetimePicker);
|
||||
const DatetimePicker = withInstall<typeof _DatetimePicker>(_DatetimePicker);
|
||||
|
||||
export default DatetimePicker;
|
||||
export { DatetimePicker };
|
||||
export type { DatetimePickerType, DatetimePickerInstance } from './types';
|
||||
|
||||
@ -120,11 +120,11 @@ Dialog.resetDefaultOptions = () => {
|
||||
Dialog.currentOptions = extend({}, Dialog.defaultOptions);
|
||||
};
|
||||
|
||||
Dialog.Component = withInstall(VanDialog);
|
||||
|
||||
Dialog.install = (app: App) => {
|
||||
app.use(Dialog.Component);
|
||||
app.use(withInstall<typeof VanDialog>(VanDialog));
|
||||
app.config.globalProperties.$dialog = Dialog;
|
||||
};
|
||||
|
||||
Dialog.Component = withInstall<typeof VanDialog>(VanDialog);
|
||||
|
||||
export { Dialog };
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Divider from './Divider';
|
||||
|
||||
export const Divider = withInstall(_Divider);
|
||||
const Divider = withInstall<typeof _Divider>(_Divider);
|
||||
|
||||
export default Divider;
|
||||
export { Divider };
|
||||
export type { DividerContentPosition } from './Divider';
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _DropdownItem from './DropdownItem';
|
||||
|
||||
export const DropdownItem = withInstall(_DropdownItem);
|
||||
const DropdownItem = withInstall<typeof _DropdownItem>(_DropdownItem);
|
||||
|
||||
export default DropdownItem;
|
||||
export { DropdownItem };
|
||||
export type { DropdownItemInstance, DropdownItemOption } from './types';
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _DropdownMenu from './DropdownMenu';
|
||||
|
||||
export const DropdownMenu = withInstall(_DropdownMenu);
|
||||
const DropdownMenu = withInstall<typeof _DropdownMenu>(_DropdownMenu);
|
||||
|
||||
export default DropdownMenu;
|
||||
export { DropdownMenu };
|
||||
export type { DropdownMenuDirection } from './types';
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Empty from './Empty';
|
||||
|
||||
export const Empty = withInstall(_Empty);
|
||||
const Empty = withInstall<typeof _Empty>(_Empty);
|
||||
|
||||
export default Empty;
|
||||
export { Empty };
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Field from './Field';
|
||||
|
||||
export const Field = withInstall(_Field);
|
||||
const Field = withInstall<typeof _Field>(_Field);
|
||||
|
||||
export default Field;
|
||||
export { Field };
|
||||
export type {
|
||||
FieldType,
|
||||
FieldRule,
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Form from './Form';
|
||||
|
||||
export const Form = withInstall(_Form);
|
||||
const Form = withInstall<typeof _Form>(_Form);
|
||||
|
||||
export default Form;
|
||||
export { Form };
|
||||
export type { FormInstance } from './types';
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _GridItem from './GridItem';
|
||||
|
||||
export const GridItem = withInstall(_GridItem);
|
||||
const GridItem = withInstall<typeof _GridItem>(_GridItem);
|
||||
|
||||
export default GridItem;
|
||||
export { GridItem };
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Grid from './Grid';
|
||||
|
||||
export const Grid = withInstall(_Grid);
|
||||
const Grid = withInstall<typeof _Grid>(_Grid);
|
||||
|
||||
export default Grid;
|
||||
export { Grid };
|
||||
export type { GridDirection } from './Grid';
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Icon from './Icon';
|
||||
|
||||
export const Icon = withInstall(_Icon);
|
||||
const Icon = withInstall<typeof _Icon>(_Icon);
|
||||
|
||||
export default Icon;
|
||||
export { Icon };
|
||||
|
||||
@ -70,10 +70,10 @@ const ImagePreview = (
|
||||
return instance;
|
||||
};
|
||||
|
||||
ImagePreview.Component = withInstall(VanImagePreview);
|
||||
ImagePreview.Component = withInstall<typeof VanImagePreview>(VanImagePreview);
|
||||
|
||||
ImagePreview.install = (app: App) => {
|
||||
app.use(ImagePreview.Component);
|
||||
app.use(withInstall<typeof VanImagePreview>(VanImagePreview));
|
||||
};
|
||||
|
||||
export { ImagePreview };
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Image from './Image';
|
||||
|
||||
export const Image = withInstall(_Image);
|
||||
const Image = withInstall<typeof _Image>(_Image);
|
||||
|
||||
export default Image;
|
||||
export { Image };
|
||||
export type { ImageFit } from './Image';
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _IndexAnchor from './IndexAnchor';
|
||||
|
||||
export const IndexAnchor = withInstall(_IndexAnchor);
|
||||
const IndexAnchor = withInstall<typeof _IndexAnchor>(_IndexAnchor);
|
||||
|
||||
export default IndexAnchor;
|
||||
export { IndexAnchor };
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _IndexBar from './IndexBar';
|
||||
|
||||
export const IndexBar = withInstall(_IndexBar);
|
||||
const IndexBar = withInstall<typeof _IndexBar>(_IndexBar);
|
||||
|
||||
export default IndexBar;
|
||||
export { IndexBar };
|
||||
export type { IndexBarInstance } from './types';
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _List from './List';
|
||||
|
||||
export const List = withInstall(_List);
|
||||
const List = withInstall<typeof _List>(_List);
|
||||
|
||||
export default List;
|
||||
export { List };
|
||||
export type { ListInstance, ListDirection } from './types';
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Loading from './Loading';
|
||||
|
||||
export const Loading = withInstall(_Loading);
|
||||
const Loading = withInstall<typeof _Loading>(_Loading);
|
||||
|
||||
export default Loading;
|
||||
export { Loading };
|
||||
export type { LoadingType } from './Loading';
|
||||
|
||||
@ -10,7 +10,7 @@ const messages = reactive<Messages>({
|
||||
'zh-CN': defaultMessages,
|
||||
});
|
||||
|
||||
export const Locale = {
|
||||
const Locale = {
|
||||
messages(): Message {
|
||||
return messages[lang.value];
|
||||
},
|
||||
@ -26,3 +26,4 @@ export const Locale = {
|
||||
};
|
||||
|
||||
export default Locale;
|
||||
export { Locale };
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _NavBar from './NavBar';
|
||||
|
||||
export const NavBar = withInstall(_NavBar);
|
||||
const NavBar = withInstall<typeof _NavBar>(_NavBar);
|
||||
|
||||
export default NavBar;
|
||||
export { NavBar };
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _NoticeBar from './NoticeBar';
|
||||
|
||||
export const NoticeBar = withInstall(_NoticeBar);
|
||||
const NoticeBar = withInstall<typeof _NoticeBar>(_NoticeBar);
|
||||
|
||||
export default NoticeBar;
|
||||
export { NoticeBar };
|
||||
export type { NoticeBarMode, NoticeBarInstance } from './types';
|
||||
|
||||
@ -23,21 +23,25 @@ export default defineComponent({
|
||||
}),
|
||||
|
||||
setup(props, { slots }) {
|
||||
return () => (
|
||||
<Popup
|
||||
show={props.show}
|
||||
class={[bem([props.type]), props.className]}
|
||||
style={{
|
||||
color: props.color,
|
||||
background: props.background,
|
||||
}}
|
||||
overlay={false}
|
||||
position="top"
|
||||
duration={0.2}
|
||||
lockScroll={props.lockScroll}
|
||||
>
|
||||
{slots.default ? slots.default() : props.message}
|
||||
</Popup>
|
||||
);
|
||||
return () => {
|
||||
const style = {
|
||||
color: props.color,
|
||||
background: props.background,
|
||||
};
|
||||
|
||||
return (
|
||||
<Popup
|
||||
show={props.show}
|
||||
class={[bem([props.type]), props.className]}
|
||||
style={style}
|
||||
overlay={false}
|
||||
position="top"
|
||||
duration={0.2}
|
||||
lockScroll={props.lockScroll}
|
||||
>
|
||||
{slots.default ? slots.default() : props.message}
|
||||
</Popup>
|
||||
);
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@ -92,11 +92,11 @@ Notify.resetDefaultOptions = () => {
|
||||
Notify.currentOptions = defaultOptions();
|
||||
};
|
||||
|
||||
Notify.Component = withInstall(VanNotify);
|
||||
|
||||
Notify.install = (app: App) => {
|
||||
app.use(Notify.Component);
|
||||
app.use(withInstall<typeof VanNotify>(VanNotify));
|
||||
app.config.globalProperties.$notify = Notify;
|
||||
};
|
||||
|
||||
Notify.Component = withInstall<typeof VanNotify>(VanNotify);
|
||||
|
||||
export { Notify };
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _NumberKeyboard from './NumberKeyboard';
|
||||
|
||||
export const NumberKeyboard = withInstall(_NumberKeyboard);
|
||||
const NumberKeyboard = withInstall<typeof _NumberKeyboard>(_NumberKeyboard);
|
||||
|
||||
export default NumberKeyboard;
|
||||
export { NumberKeyboard };
|
||||
export type { NumberKeyboardTheme } from './NumberKeyboard';
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Overlay from './Overlay';
|
||||
|
||||
export const Overlay = withInstall(_Overlay);
|
||||
const Overlay = withInstall<typeof _Overlay>(_Overlay);
|
||||
|
||||
export default Overlay;
|
||||
export { Overlay };
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Pagination from './Pagination';
|
||||
|
||||
export const Pagination = withInstall(_Pagination);
|
||||
const Pagination = withInstall<typeof _Pagination>(_Pagination);
|
||||
|
||||
export default Pagination;
|
||||
export { Pagination };
|
||||
export type { PaginationMode } from './Pagination';
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _PasswordInput from './PasswordInput';
|
||||
|
||||
export const PasswordInput = withInstall(_PasswordInput);
|
||||
const PasswordInput = withInstall<typeof _PasswordInput>(_PasswordInput);
|
||||
|
||||
export default PasswordInput;
|
||||
export { PasswordInput };
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Picker from './Picker';
|
||||
|
||||
export const Picker = withInstall(_Picker);
|
||||
const Picker = withInstall<typeof _Picker>(_Picker);
|
||||
|
||||
export default Picker;
|
||||
export { Picker };
|
||||
export type {
|
||||
PickerColumn,
|
||||
PickerOption,
|
||||
|
||||
@ -79,7 +79,7 @@ export default defineComponent({
|
||||
closeOnClickOverlay: truthProp,
|
||||
closeOnClickOutside: truthProp,
|
||||
offset: {
|
||||
type: Array as unknown as PropType<[number, number]>,
|
||||
type: (Array as unknown) as PropType<[number, number]>,
|
||||
default: () => [0, 8],
|
||||
},
|
||||
theme: {
|
||||
@ -112,28 +112,24 @@ export default defineComponent({
|
||||
const wrapperRef = ref<HTMLElement>();
|
||||
const popoverRef = ref<ComponentInstance>();
|
||||
|
||||
const createPopperInstance = () => {
|
||||
if (wrapperRef.value && popoverRef.value) {
|
||||
return createPopper(wrapperRef.value, popoverRef.value.popupRef.value, {
|
||||
placement: props.placement,
|
||||
modifiers: [
|
||||
{
|
||||
name: 'computeStyles',
|
||||
options: {
|
||||
adaptive: false,
|
||||
gpuAcceleration: false,
|
||||
},
|
||||
const createPopperInstance = () =>
|
||||
createPopper(wrapperRef.value!, popoverRef.value!.popupRef.value, {
|
||||
placement: props.placement,
|
||||
modifiers: [
|
||||
{
|
||||
name: 'computeStyles',
|
||||
options: {
|
||||
adaptive: false,
|
||||
gpuAcceleration: false,
|
||||
},
|
||||
extend({}, offsetModifier, {
|
||||
options: {
|
||||
offset: props.offset,
|
||||
},
|
||||
}),
|
||||
],
|
||||
});
|
||||
}
|
||||
return null;
|
||||
};
|
||||
},
|
||||
extend({}, offsetModifier, {
|
||||
options: {
|
||||
offset: props.offset,
|
||||
},
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
const updateLocation = () => {
|
||||
nextTick(() => {
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Popover from './Popover';
|
||||
|
||||
export const Popover = withInstall(_Popover);
|
||||
const Popover = withInstall<typeof _Popover>(_Popover);
|
||||
|
||||
export default Popover;
|
||||
export { Popover };
|
||||
export type {
|
||||
PopoverTheme,
|
||||
PopoverAction,
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Popup from './Popup';
|
||||
|
||||
export const Popup = withInstall(_Popup);
|
||||
const Popup = withInstall<typeof _Popup>(_Popup);
|
||||
|
||||
export default Popup;
|
||||
export { Popup };
|
||||
export type { PopupPosition, PopupCloseIconPosition } from './Popup';
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Progress from './Progress';
|
||||
|
||||
export const Progress = withInstall(_Progress);
|
||||
const Progress = withInstall<typeof _Progress>(_Progress);
|
||||
|
||||
export default Progress;
|
||||
export { Progress };
|
||||
export type { ProgressInstance } from './types';
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _PullRefresh from './PullRefresh';
|
||||
|
||||
export const PullRefresh = withInstall(_PullRefresh);
|
||||
const PullRefresh = withInstall<typeof _PullRefresh>(_PullRefresh);
|
||||
|
||||
export default PullRefresh;
|
||||
export { PullRefresh };
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _RadioGroup from './RadioGroup';
|
||||
|
||||
export const RadioGroup = withInstall(_RadioGroup);
|
||||
const RadioGroup = withInstall<typeof _RadioGroup>(_RadioGroup);
|
||||
|
||||
export default RadioGroup;
|
||||
export { RadioGroup };
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Radio from './Radio';
|
||||
|
||||
export const Radio = withInstall(_Radio);
|
||||
const Radio = withInstall<typeof _Radio>(_Radio);
|
||||
|
||||
export default Radio;
|
||||
export { Radio };
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Rate from './Rate';
|
||||
|
||||
export const Rate = withInstall(_Rate);
|
||||
const Rate = withInstall<typeof _Rate>(_Rate);
|
||||
|
||||
export default Rate;
|
||||
export { Rate };
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Row from './Row';
|
||||
|
||||
export const Row = withInstall(_Row);
|
||||
const Row = withInstall<typeof _Row>(_Row);
|
||||
|
||||
export default Row;
|
||||
export { Row };
|
||||
export type { RowAlign, RowJustify } from './Row';
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Search from './Search';
|
||||
|
||||
export const Search = withInstall(_Search);
|
||||
const Search = withInstall<typeof _Search>(_Search);
|
||||
|
||||
export default Search;
|
||||
export { Search };
|
||||
export type { SearchShape, SearchInstance } from './types';
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _ShareSheet from './ShareSheet';
|
||||
|
||||
export const ShareSheet = withInstall(_ShareSheet);
|
||||
const ShareSheet = withInstall<typeof _ShareSheet>(_ShareSheet);
|
||||
|
||||
export default ShareSheet;
|
||||
export { ShareSheet };
|
||||
export type { ShareSheetOption, ShareSheetOptions } from './ShareSheet';
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _SidebarItem from './SidebarItem';
|
||||
|
||||
export const SidebarItem = withInstall(_SidebarItem);
|
||||
const SidebarItem = withInstall<typeof _SidebarItem>(_SidebarItem);
|
||||
|
||||
export default SidebarItem;
|
||||
export { SidebarItem };
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Sidebar from './Sidebar';
|
||||
|
||||
export const Sidebar = withInstall(_Sidebar);
|
||||
const Sidebar = withInstall<typeof _Sidebar>(_Sidebar);
|
||||
|
||||
export default Sidebar;
|
||||
export { Sidebar };
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Skeleton from './Skeleton';
|
||||
|
||||
export const Skeleton = withInstall(_Skeleton);
|
||||
const Skeleton = withInstall<typeof _Skeleton>(_Skeleton);
|
||||
|
||||
export default Skeleton;
|
||||
export { Skeleton };
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Slider from './Slider';
|
||||
|
||||
export const Slider = withInstall(_Slider);
|
||||
const Slider = withInstall<typeof _Slider>(_Slider);
|
||||
|
||||
export default Slider;
|
||||
export { Slider };
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Step from './Step';
|
||||
|
||||
export const Step = withInstall(_Step);
|
||||
const Step = withInstall<typeof _Step>(_Step);
|
||||
|
||||
export default Step;
|
||||
export { Step };
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Stepper, { StepperTheme } from './Stepper';
|
||||
|
||||
export const Stepper = withInstall(_Stepper);
|
||||
const Stepper = withInstall<typeof _Stepper>(_Stepper);
|
||||
|
||||
export default Stepper;
|
||||
export { Stepper };
|
||||
export type { StepperTheme };
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Steps from './Steps';
|
||||
|
||||
export const Steps = withInstall(_Steps);
|
||||
const Steps = withInstall<typeof _Steps>(_Steps);
|
||||
|
||||
export default Steps;
|
||||
export { Steps };
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Sticky from './Sticky';
|
||||
|
||||
export const Sticky = withInstall(_Sticky);
|
||||
const Sticky = withInstall<typeof _Sticky>(_Sticky);
|
||||
|
||||
export default Sticky;
|
||||
export { Sticky };
|
||||
export type { StickyPosition } from './Sticky';
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _SubmitBar from './SubmitBar';
|
||||
|
||||
export const SubmitBar = withInstall(_SubmitBar);
|
||||
const SubmitBar = withInstall<typeof _SubmitBar>(_SubmitBar);
|
||||
|
||||
export default SubmitBar;
|
||||
export { SubmitBar };
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _SwipeCell from './SwipeCell';
|
||||
|
||||
export const SwipeCell = withInstall(_SwipeCell);
|
||||
const SwipeCell = withInstall<typeof _SwipeCell>(_SwipeCell);
|
||||
|
||||
export default SwipeCell;
|
||||
export { SwipeCell };
|
||||
export type {
|
||||
SwipeCellSide,
|
||||
SwipeCellPosition,
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _SwipeItem from './SwipeItem';
|
||||
|
||||
export const SwipeItem = withInstall(_SwipeItem);
|
||||
const SwipeItem = withInstall<typeof _SwipeItem>(_SwipeItem);
|
||||
|
||||
export default SwipeItem;
|
||||
export { SwipeItem };
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Swipe from './Swipe';
|
||||
|
||||
export const Swipe = withInstall(_Swipe);
|
||||
const Swipe = withInstall<typeof _Swipe>(_Swipe);
|
||||
|
||||
export default Swipe;
|
||||
export { Swipe };
|
||||
export type { SwipeInstance, SwipeToOptions } from './types';
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Switch from './Switch';
|
||||
|
||||
export const Switch = withInstall(_Switch);
|
||||
const Switch = withInstall<typeof _Switch>(_Switch);
|
||||
|
||||
export default Switch;
|
||||
export { Switch };
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Tab from './Tab';
|
||||
|
||||
export const Tab = withInstall(_Tab);
|
||||
const Tab = withInstall<typeof _Tab>(_Tab);
|
||||
|
||||
export default Tab;
|
||||
export { Tab };
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _TabbarItem from './TabbarItem';
|
||||
|
||||
export const TabbarItem = withInstall(_TabbarItem);
|
||||
const TabbarItem = withInstall<typeof _TabbarItem>(_TabbarItem);
|
||||
|
||||
export default TabbarItem;
|
||||
export { TabbarItem };
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Tabbar from './Tabbar';
|
||||
|
||||
export const Tabbar = withInstall(_Tabbar);
|
||||
const Tabbar = withInstall<typeof _Tabbar>(_Tabbar);
|
||||
|
||||
export default Tabbar;
|
||||
export { Tabbar };
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Tabs from './Tabs';
|
||||
|
||||
export const Tabs = withInstall(_Tabs);
|
||||
const Tabs = withInstall<typeof _Tabs>(_Tabs);
|
||||
|
||||
export default Tabs;
|
||||
export { Tabs };
|
||||
export type { TabsType, TabsInstance } from './types';
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Tag from './Tag';
|
||||
|
||||
export const Tag = withInstall(_Tag);
|
||||
const Tag = withInstall<typeof _Tag>(_Tag);
|
||||
|
||||
export default Tag;
|
||||
export { Tag };
|
||||
|
||||
@ -78,7 +78,9 @@ export default defineComponent({
|
||||
}
|
||||
};
|
||||
|
||||
const clearTimer = () => clearTimeout(timer);
|
||||
const clearTimer = () => {
|
||||
clearTimeout(timer);
|
||||
};
|
||||
|
||||
const renderIcon = () => {
|
||||
const { icon, type, iconSize, iconPrefix, loadingType } = props;
|
||||
|
||||
@ -155,7 +155,7 @@ Toast.clear = (all?: boolean) => {
|
||||
} else if (!allowMultiple) {
|
||||
queue[0].clear();
|
||||
} else {
|
||||
queue.shift()?.clear();
|
||||
queue.shift()!.clear();
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -186,7 +186,7 @@ Toast.allowMultiple = (value = true) => {
|
||||
};
|
||||
|
||||
Toast.install = (app: App) => {
|
||||
app.use(withInstall(VanToast));
|
||||
app.use(withInstall<typeof VanToast>(VanToast));
|
||||
app.config.globalProperties.$toast = Toast;
|
||||
};
|
||||
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _TreeSelect from './TreeSelect';
|
||||
|
||||
export const TreeSelect = withInstall(_TreeSelect);
|
||||
const TreeSelect = withInstall<typeof _TreeSelect>(_TreeSelect);
|
||||
|
||||
export default TreeSelect;
|
||||
export { TreeSelect };
|
||||
export type { TreeSelectItem, TreeSelectChild } from './TreeSelect';
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
import { withInstall } from '../utils';
|
||||
import _Uploader from './Uploader';
|
||||
|
||||
export const Uploader = withInstall(_Uploader);
|
||||
const Uploader = withInstall<typeof _Uploader>(_Uploader);
|
||||
|
||||
export default Uploader;
|
||||
export { Uploader };
|
||||
export type {
|
||||
UploaderInstance,
|
||||
UploaderResultType,
|
||||
|
||||
@ -14,12 +14,13 @@ export type WithInstall<T> = T & {
|
||||
install(app: App): void;
|
||||
} & EventShim;
|
||||
|
||||
export function withInstall<T>(options: T) {
|
||||
// using any here because tsc will generate some weird results when using generics
|
||||
export function withInstall<T>(options: any): WithInstall<T> {
|
||||
(options as Record<string, unknown>).install = (app: App) => {
|
||||
const { name } = options as any;
|
||||
app.component(name, options);
|
||||
app.component(camelize(`-${name}`), options);
|
||||
};
|
||||
|
||||
return options as WithInstall<T>;
|
||||
return options;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user