feat:封装对象trim通用方法

master
zhoulei 3 years ago
parent 0fef691249
commit 69652d36ed

@ -107,7 +107,6 @@ export default class LoginPage extends BasePage {
get serverAddress(): string | null { get serverAddress(): string | null {
return server.serverAddress; return server.serverAddress;
} }
// //
username = ''; username = '';
@Watch('username') @Watch('username')

@ -1,7 +1,7 @@
/* /*
* @Author: zhou lei * @Author: zhou lei
* @Date: 2022-01-20 11:26:20 * @Date: 2022-01-20 11:26:20
* @LastEditTime: 2022-01-20 17:48:10 * @LastEditTime: 2022-01-22 10:21:10
* @LastEditors: zhou lei * @LastEditors: zhou lei
* @Description: * @Description:
* @FilePath: /wms_haiwai_app/src/utils/mixin.ts * @FilePath: /wms_haiwai_app/src/utils/mixin.ts
@ -9,7 +9,7 @@
*/ */
import Vue from 'vue'; import Vue from 'vue';
import { Component } from 'vue-property-decorator'; import { Component } from 'vue-property-decorator';
import _ from 'lodash';
@Component // 一定要用Component修饰 @Component // 一定要用Component修饰
export default class MyMixins extends Vue { export default class MyMixins extends Vue {
customToast(msg: string, type = 'MODEL', title = '') { 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));
}
} }

@ -2,7 +2,7 @@
/* /*
* @Author: zhou lei * @Author: zhou lei
* @Date: 2022-01-21 09:23:56 * @Date: 2022-01-21 09:23:56
* @LastEditTime: 2022-01-21 11:47:17 * @LastEditTime: 2022-01-22 09:58:04
* @LastEditors: zhou lei * @LastEditors: zhou lei
* @Description: * @Description:
* @FilePath: /wms_haiwai_app/types/vue-prototype.d.ts * @FilePath: /wms_haiwai_app/types/vue-prototype.d.ts
@ -22,5 +22,16 @@ declare module 'vue/types/vue' {
* @memberof Vue * @memberof Vue
*/ */
customToast(msg: string, type?: string = 'toast', title?: string = ''): void; 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;
} }
} }

Loading…
Cancel
Save