export const trim = {
    methods: {
        trim(value) {
            /**去除首尾空白 */
            return value.replace(/(^\s*)|(\s*$)/g, "");
        },

    }
}
export const validateSpecialCharacter = {
    methods: {
       /**验证特殊字符和空格 */
       inputformat (event,value) { 
            if (this.composing) {
                return
            }
            let inputValue = event.target.value
            event.target.value = event.target.value.replace(/[^\a-\z\A-\Z0-9_\u4E00-\u9FA5]/g, "")
            let filterValue = inputValue.replace(/[^\a-\z\A-\Z0-9_\u4E00-\u9FA5]/g, "")
            util.setDeepValue(value,filterValue)(this);
            event.target.dispatchEvent(new Event('input'))
        },
        compositionstart (data) {
            this.composing = true
        },
        compositionend ($event) {
            this.composing = false
        }
    }
}


Logo

前往低代码交流专区

更多推荐