Skip to content

Commit

Permalink
Merge pull request #6 from Astrian/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Astrian authored Nov 30, 2024
2 parents e310c37 + d6a4405 commit 9df85fa
Show file tree
Hide file tree
Showing 5 changed files with 195 additions and 87 deletions.
42 changes: 15 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,21 @@ npm install cfturnstile-vue3
```

```vue
<template>
<div id="app">
<cfturnstile
:sitekey="sitekey"
@verify="verify"
/>
</div>
</template>
<script>
import { defineComponent } from 'vue'
<script setup lang="ts">
import Turnstile from 'cfturnstile-vue3'
export default defineComponent({
name: 'App',
components: {
Turnstile
},
data() {
return {
sitekey: 'YOUR_SITE_KEY'
}
},
methods: {
verify(token) {
console.log(token)
}
}
})
const sitekey = import.meta.env.VITE_SITEKEY as string
</script>
<template>
<Turnstile
:sitekey="sitekey"
@callback="e => console.log('success', e)"
size="compact"
/>
</template>
```

Refer to [official document](https://developers.cloudflare.com/turnstile/get-started/client-side-rendering/#configurations) for all configurations.

## Upgrade from v1.0.0
We aligned the configuration parameters with the official widget document in version 2.0.0, which is disruptive for existing v1.0.0 users. Please remember to update the parameters to ensure that the widget works as normal.
104 changes: 57 additions & 47 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cfturnstile-vue3",
"version": "1.0.0",
"version": "2.0.0",
"main": "./dist/cfturnstile-vue3.umd.js",
"scripts": {
"build": "vue-tsc --declaration --emitDeclarationOnly && vite build",
Expand All @@ -23,7 +23,8 @@
"exports": {
".": {
"import": "./dist/cfturnstile-vue3.mjs",
"require": "./dist/cfturnstile-vue3.umd.js"
"require": "./dist/cfturnstile-vue3.umd.js",
"types": "./dist_types/index.d.ts"
}
},
"homepage": "https://github.com/Astrian/cfturnstile-vue3",
Expand Down
Loading

0 comments on commit 9df85fa

Please sign in to comment.