chore: prettier all ts code
This commit is contained in:
@@ -20,7 +20,10 @@ export const ClickOutsideMixin = (config: ClickOutsideMixinConfig) =>
|
||||
|
||||
data() {
|
||||
const clickOutsideHandler = (event: Event) => {
|
||||
if (this.closeOnClickOutside && !this.$el.contains(event.target as Node)) {
|
||||
if (
|
||||
this.closeOnClickOutside &&
|
||||
!this.$el.contains(event.target as Node)
|
||||
) {
|
||||
(this as any)[config.method]();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@ function getElement(selector: string | GetContainer): Element | null {
|
||||
export function PortalMixin({ ref, afterPortal }: PortalMixinOptions) {
|
||||
return Vue.extend({
|
||||
props: {
|
||||
getContainer: [String, Function] as (PropType<string | GetContainer>),
|
||||
getContainer: [String, Function] as PropType<string | GetContainer>,
|
||||
},
|
||||
|
||||
watch: {
|
||||
@@ -33,7 +33,7 @@ export function PortalMixin({ ref, afterPortal }: PortalMixinOptions) {
|
||||
methods: {
|
||||
portal() {
|
||||
const { getContainer } = this;
|
||||
const el = ref ? this.$refs[ref] as HTMLElement : this.$el;
|
||||
const el = ref ? (this.$refs[ref] as HTMLElement) : this.$el;
|
||||
|
||||
let container;
|
||||
if (getContainer) {
|
||||
|
||||
+10
-3
@@ -25,7 +25,10 @@ type ChildrenMixinThis = {
|
||||
disableBindRelation?: boolean;
|
||||
};
|
||||
|
||||
export function ChildrenMixin(parent: string, options: ChildrenMixinOptions = {}) {
|
||||
export function ChildrenMixin(
|
||||
parent: string,
|
||||
options: ChildrenMixinOptions = {}
|
||||
) {
|
||||
const indexKey = options.indexKey || 'index';
|
||||
|
||||
return Vue.extend({
|
||||
@@ -56,7 +59,9 @@ export function ChildrenMixin(parent: string, options: ChildrenMixinOptions = {}
|
||||
|
||||
beforeDestroy() {
|
||||
if (this.parent) {
|
||||
this.parent.children = this.parent.children.filter((item: any) => item !== this);
|
||||
this.parent.children = this.parent.children.filter(
|
||||
(item: any) => item !== this
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -68,7 +73,9 @@ export function ChildrenMixin(parent: string, options: ChildrenMixinOptions = {}
|
||||
|
||||
const children = [...this.parent.children, this];
|
||||
const vnodes = flattenVNodes(this.parent.slots());
|
||||
children.sort((a, b) => vnodes.indexOf(a.$vnode) - vnodes.indexOf(b.$vnode));
|
||||
children.sort(
|
||||
(a, b) => vnodes.indexOf(a.$vnode) - vnodes.indexOf(b.$vnode)
|
||||
);
|
||||
|
||||
this.parent.children = children;
|
||||
},
|
||||
|
||||
+2
-1
@@ -58,7 +58,8 @@ export const TouchMixin = Vue.extend({
|
||||
// avoid Vue 2.6 event bubble issues by manually binding events
|
||||
// https://github.com/youzan/vant/issues/3015
|
||||
bindTouchEvent(el: HTMLElement) {
|
||||
const { onTouchStart, onTouchMove, onTouchEnd } = (this as any);
|
||||
const { onTouchStart, onTouchMove, onTouchEnd } = this as any;
|
||||
|
||||
on(el, 'touchstart', onTouchStart);
|
||||
on(el, 'touchmove', onTouchMove);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user