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