mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
chore: prefer using extend (#8531)
This commit is contained in:
parent
dde06c43fe
commit
0a9f2102d1
@ -166,7 +166,7 @@ export default defineComponent({
|
||||
const detail = areaRef.value.getArea();
|
||||
detail.areaCode = detail.code;
|
||||
delete detail.code;
|
||||
Object.assign(state.data, detail);
|
||||
extend(state.data, detail);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
import { getCurrentInstance } from 'vue';
|
||||
import { extend } from '../utils';
|
||||
|
||||
// expose public api
|
||||
export function useExpose(apis: Record<string, any>) {
|
||||
const instance = getCurrentInstance();
|
||||
if (instance) {
|
||||
Object.assign(instance.proxy, apis);
|
||||
extend(instance.proxy, apis);
|
||||
}
|
||||
}
|
||||
|
@ -105,9 +105,7 @@ export default defineComponent({
|
||||
|
||||
watch(
|
||||
() => props.contactInfo,
|
||||
(value) => {
|
||||
Object.assign(contact, DEFAULT_CONTACT, value);
|
||||
}
|
||||
(value) => extend(contact, DEFAULT_CONTACT, value)
|
||||
);
|
||||
|
||||
return () => (
|
||||
|
@ -108,7 +108,7 @@ Dialog.close = () => {
|
||||
};
|
||||
|
||||
Dialog.setDefaultOptions = (options: DialogOptions) => {
|
||||
Object.assign(Dialog.currentOptions, options);
|
||||
extend(Dialog.currentOptions, options);
|
||||
};
|
||||
|
||||
Dialog.resetDefaultOptions = () => {
|
||||
|
@ -85,7 +85,7 @@ Notify.clear = () => {
|
||||
Notify.currentOptions = defaultOptions();
|
||||
|
||||
Notify.setDefaultOptions = (options: NotifyOptions) => {
|
||||
Object.assign(Notify.currentOptions, options);
|
||||
extend(Notify.currentOptions, options);
|
||||
};
|
||||
|
||||
Notify.resetDefaultOptions = () => {
|
||||
|
@ -166,7 +166,7 @@ function setDefaultOptions(type: ToastType | ToastOptions, options?: any) {
|
||||
if (typeof type === 'string') {
|
||||
defaultOptionsMap[type] = options;
|
||||
} else {
|
||||
Object.assign(currentOptions, type);
|
||||
extend(currentOptions, type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { createApp, reactive, Component, nextTick } from 'vue';
|
||||
import { extend } from '../utils';
|
||||
import { useExpose } from '../composables/use-expose';
|
||||
|
||||
export function usePopupState() {
|
||||
@ -11,7 +12,7 @@ export function usePopupState() {
|
||||
};
|
||||
|
||||
const open = (props: Record<string, any>) => {
|
||||
Object.assign(state, props);
|
||||
extend(state, props);
|
||||
nextTick(() => toggle(true));
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user