定义一个公共js文件,commonFun.js
然后再main.js中引入:
import commonFun from "@/utils/commonFun";
Vue.prototype.utils = commonFun;
然后在单页面中直接使用:
this.queryCondition.poLines = this.utils.gridFormat(this.queryCondition.gpirsNo)
gridFormat(newVal) {
console.log("🚀 ~ file: commonFun.js ~ line 61 ~ gridFormat ~ newVal", newVal)
var temp = []
if (newVal.length > 0) {
var arr = newVal.replaceAll('/', ',').trim().split(',');
if (arr.length > 50) {
var temp = arr.splice(0, 50)
Message.error(this.$t('prompt.limitWord'));
return false
} else {
temp = arr
}
return temp;
} else {
return temp;
}
},
某个查询条件允许输入多个查询值,支持空格和逗号
最新推荐文章于 2024-05-05 12:08:42 发布