Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
fj-captcha-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
郑磊
fj-captcha-service
Commits
3b8a8b51
Commit
3b8a8b51
authored
May 17, 2024
by
郑磊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支持圆角设置
parent
6b7ab953
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
Captcha.vue
vue/src/Captcha.vue
+11
-3
App.vue
web/src/App.vue
+7
-1
No files found.
vue/src/Captcha.vue
View file @
3b8a8b51
<
script
setup
lang=
"ts"
>
import
{
PropType
,
onMounted
,
ref
,
toRef
}
from
'vue'
import
{
PropType
,
computed
,
onMounted
,
ref
,
toRef
}
from
'vue'
import
ConcatCaptcha
from
'./captcha-views/ConcatCaptcha.vue'
import
RotateCaptcha
from
'./captcha-views/RotateCaptcha.vue'
import
SliderCaptcha
from
'./captcha-views/SliderCaptcha.vue'
...
...
@@ -34,8 +34,7 @@ const props = defineProps({
default
:
true
,
},
radius
:
{
type
:
Boolean
,
default
:
true
,
type
:
Number
,
},
shadow
:
{
type
:
Boolean
,
...
...
@@ -50,6 +49,14 @@ const props = defineProps({
},
})
const
radiusStyle
=
computed
(()
=>
typeof
props
.
radius
===
'number'
&&
!
isNaN
(
props
.
radius
)
&&
props
.
radius
>=
0
?
{
borderRadius
:
`
${
props
.
radius
}
px`
}
:
{},
)
const
locale
=
toRef
(
props
,
'locale'
)
provideLocale
(
locale
)
...
...
@@ -163,6 +170,7 @@ defineExpose({
'captcha--container--radius': radius,
'captcha--container--shadow': shadow,
}"
:style="radiusStyle"
@touchmove.prevent
@mousemove.prevent
>
...
...
web/src/App.vue
View file @
3b8a8b51
...
...
@@ -8,7 +8,13 @@ const validCaptchaUrl = import.meta.env.VITE_VALID_CAPTCHA_URL
//通过URL上的参数解析验证码组件的参数
const
{
radius
,
shadow
,
locale
,
callback
,
extra
,
style
}
=
(()
=>
{
const
url
=
new
URL
(
location
.
href
)
const
radius
=
url
.
searchParams
.
get
(
'radius'
)
===
'1'
const
radius
=
(()
=>
{
let
value
=
url
.
searchParams
.
get
(
'radius'
)
if
(
value
===
null
)
return
undefined
const
num
=
parseFloat
(
value
)
if
(
isNaN
(
num
)
||
num
<
0
)
return
undefined
return
num
})()
const
shadow
=
url
.
searchParams
.
get
(
'shadow'
)
===
'1'
const
locale
=
url
.
searchParams
.
get
(
'lang'
)
??
undefined
const
callback
=
url
.
searchParams
.
get
(
'callback'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment