chore: fix lint issues
This commit is contained in:
+5
-4
@@ -2,7 +2,8 @@ import { ref } from 'vue';
|
||||
import { deepAssign } from '../utils/deep-assign';
|
||||
import defaultMessages from './lang/zh-CN';
|
||||
|
||||
type Messages = Record<string, Record<string, any>>;
|
||||
type Message = Record<string, any>;
|
||||
type Messages = Record<string, Message>;
|
||||
|
||||
const lang = ref('zh-CN');
|
||||
const messages = ref<Messages>({
|
||||
@@ -10,16 +11,16 @@ const messages = ref<Messages>({
|
||||
});
|
||||
|
||||
export default {
|
||||
messages() {
|
||||
messages(): Message {
|
||||
return messages.value[lang.value];
|
||||
},
|
||||
|
||||
use(newLang: string, newMessages?: object) {
|
||||
use(newLang: string, newMessages?: Message) {
|
||||
lang.value = newLang;
|
||||
this.add({ [newLang]: newMessages });
|
||||
},
|
||||
|
||||
add(newMessages = {}) {
|
||||
add(newMessages: Message = {}) {
|
||||
deepAssign(messages.value, newMessages);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@ type BindEventMixinThis = {
|
||||
binded: boolean;
|
||||
};
|
||||
|
||||
type BindEventHandler = (bind: Function, isBind: boolean) => void;
|
||||
type BindEventHandler = (bind: typeof on | typeof off, isBind: boolean) => void;
|
||||
|
||||
export function BindEventMixin(handler: BindEventHandler) {
|
||||
function bind(this: BindEventMixinThis) {
|
||||
|
||||
@@ -27,17 +27,11 @@
|
||||
</demo-block>
|
||||
|
||||
<demo-block card v-if="!isWeapp" :title="t('cascade')">
|
||||
<van-picker
|
||||
:title="t('title')"
|
||||
:columns="t('cascadeColumns')"
|
||||
/>
|
||||
<van-picker :title="t('title')" :columns="t('cascadeColumns')" />
|
||||
</demo-block>
|
||||
|
||||
<demo-block card :title="t('disableOption')">
|
||||
<van-picker
|
||||
:title="t('title')"
|
||||
:columns="t('disabledColumns')"
|
||||
/>
|
||||
<van-picker :title="t('title')" :columns="t('disabledColumns')" />
|
||||
</demo-block>
|
||||
|
||||
<demo-block card :title="t('setColumnValues')">
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ export function scrollTopTo(
|
||||
scroller: HTMLElement,
|
||||
to: number,
|
||||
duration: number,
|
||||
callback: Function
|
||||
callback: () => void
|
||||
) {
|
||||
let current = getScrollTop(scroller);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ function assignKey(to: ObjectIndex, from: ObjectIndex, key: string) {
|
||||
if (!hasOwnProperty.call(to, key) || !isObject(val)) {
|
||||
to[key] = val;
|
||||
} else {
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
to[key] = deepAssign(Object(to[key]), from[key]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { deepAssign } from './deep-assign';
|
||||
|
||||
export function deepClone(obj: object): object {
|
||||
export function deepClone(obj: Record<string, any>): Record<string, any> {
|
||||
if (Array.isArray(obj)) {
|
||||
return obj.map((item) => deepClone(item));
|
||||
}
|
||||
|
||||
+2
-1
@@ -4,12 +4,13 @@ export { createNamespace } from './create';
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
export function noop() {}
|
||||
|
||||
export const inBrowser = typeof window !== 'undefined'
|
||||
export const inBrowser = typeof window !== 'undefined';
|
||||
|
||||
export function isDef(val: unknown): boolean {
|
||||
return val !== undefined && val !== null;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export function isFunction(val: unknown): val is Function {
|
||||
return typeof val === 'function';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user