From 24a64475ee9582f0f09f899b7800a4f7101eaa30 Mon Sep 17 00:00:00 2001 From: 懒羊羊 <15939171744@163.com> Date: 星期二, 09 一月 2024 14:25:19 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- jcdm-ui/src/main.js | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/jcdm-ui/src/main.js b/jcdm-ui/src/main.js index c9f70f1..aea3622 100644 --- a/jcdm-ui/src/main.js +++ b/jcdm-ui/src/main.js @@ -85,3 +85,19 @@ store, render: h => h(App) }) +//ip楠岃瘉 +Vue.directive('ipAddressValidator', { + bind(el, binding, vnode) { + el.addEventListener('input', () => { + const value = el.value; + // IPv4 address validation + if (/^((\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])(\.((\d{1,2}|1\d{2}|2[0-4]\d|25[0-5]))){3})$/.test(value)) { + console.log("Valid IPv4 Address"); + } else if (!/(^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$)|(^(?:(?:[\x00-\x7F]|[\u0391-\uFFEF])+)(?:\.[a-zA-Z0-9]+)*$)/i.test(value)) { + console.log("Invalid IPv4 or IPv6 Address"); + } else { + console.log("Valid IPv6 Address"); + } + }); + }, +}); -- Gitblit v1.9.3