index.ts
573 Bytes
import { Rule } from '/@/components/Form';
import { useI18n } from '/@/hooks/web/useI18n';
export { default as ObjectModelForm } from './index.vue';
const { t } = useI18n();
export function createHexCommandRuleValidator(): Rule[] {
return [
{
message: t('deviceManagement.product.hexCommandRuleMessageText'),
validator(_rule, value, _callback) {
const reg = /^[\s0-9a-fA-F]+$/;
if (reg.test(value)) return Promise.resolve();
return Promise.reject(t('deviceManagement.product.hexCommandRuleMessageText'));
},
},
];
}