From 69652d36eda56799de38bf0cd650efc714500f86 Mon Sep 17 00:00:00 2001 From: zhoulei Date: Sat, 22 Jan 2022 10:32:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=B0=81=E8=A3=85=E5=AF=B9=E8=B1=A1trim?= =?UTF-8?q?=E9=80=9A=E7=94=A8=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/login/login/index.vue | 1 - src/utils/mixin.ts | 14 ++++++++++++-- types/vue-prototype.d.ts | 13 ++++++++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/pages/login/login/index.vue b/src/pages/login/login/index.vue index 968e305..017292c 100644 --- a/src/pages/login/login/index.vue +++ b/src/pages/login/login/index.vue @@ -107,7 +107,6 @@ export default class LoginPage extends BasePage { get serverAddress(): string | null { return server.serverAddress; } - // 小数点保留 username = ''; @Watch('username') diff --git a/src/utils/mixin.ts b/src/utils/mixin.ts index d04d3a7..78f83ad 100644 --- a/src/utils/mixin.ts +++ b/src/utils/mixin.ts @@ -1,7 +1,7 @@ /* * @Author: zhou lei * @Date: 2022-01-20 11:26:20 - * @LastEditTime: 2022-01-20 17:48:10 + * @LastEditTime: 2022-01-22 10:21:10 * @LastEditors: zhou lei * @Description: * @FilePath: /wms_haiwai_app/src/utils/mixin.ts @@ -9,7 +9,7 @@ */ import Vue from 'vue'; import { Component } from 'vue-property-decorator'; - +import _ from 'lodash'; @Component // 一定要用Component修饰 export default class MyMixins extends Vue { customToast(msg: string, type = 'MODEL', title = '') { @@ -26,4 +26,14 @@ export default class MyMixins extends Vue { }); } } + /** + * search trim 去空格 + * + * @param {*} v + * @param {*} key + * @memberof MyMixins + */ + searchchange(v, key) { + _.set(this, key, this.$u.trim(v)); + } } diff --git a/types/vue-prototype.d.ts b/types/vue-prototype.d.ts index 638147a..bbb2ec4 100644 --- a/types/vue-prototype.d.ts +++ b/types/vue-prototype.d.ts @@ -2,7 +2,7 @@ /* * @Author: zhou lei * @Date: 2022-01-21 09:23:56 - * @LastEditTime: 2022-01-21 11:47:17 + * @LastEditTime: 2022-01-22 09:58:04 * @LastEditors: zhou lei * @Description: * @FilePath: /wms_haiwai_app/types/vue-prototype.d.ts @@ -22,5 +22,16 @@ declare module 'vue/types/vue' { * @memberof Vue */ customToast(msg: string, type?: string = 'toast', title?: string = ''): void; + $u: { + trim(v: any); + }; + /** + * search trim 去空格 + * + * @param {*} v + * @param {*} key + * @memberof Vue + */ + searchchange(v: any, key: any): void; } }