-
Notifications
You must be signed in to change notification settings - Fork 713
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab25622
commit abb6906
Showing
13 changed files
with
200 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import IAgree from './src/IAgree.vue' | ||
|
||
export type { LinkItem, IAgreeProps } from './src/types' | ||
export { IAgree } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<script lang="ts" setup> | ||
import { ElCheckbox } from 'element-plus' | ||
import { Highlight } from '@/components/Highlight' | ||
import { PropType, computed } from 'vue' | ||
import { LinkItem } from './types' | ||
const props = defineProps({ | ||
text: { | ||
type: String, | ||
default: '' | ||
}, | ||
link: { | ||
type: Array as PropType<LinkItem[]>, | ||
default: undefined | ||
} | ||
}) | ||
const modelValue = defineModel<boolean>() | ||
const highlightKeys = computed(() => { | ||
return props.link?.map((item) => item.text) || [] | ||
}) | ||
const keyClick = (key: string) => { | ||
const linkItem = props.link?.find((item) => item.text === key) | ||
if (linkItem?.url) { | ||
window.open(linkItem.url) | ||
return | ||
} | ||
if (linkItem?.onClick) { | ||
linkItem.onClick() | ||
} | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="flex items-center"> | ||
<ElCheckbox v-model="modelValue" class="mr-0px!" /> | ||
<Highlight class="ml-10px" :keys="highlightKeys" @click="keyClick">{{ text }}</Highlight> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export interface LinkItem { | ||
text: string | ||
url?: string | ||
onClick?: () => void | ||
} | ||
|
||
export interface IAgreeProps { | ||
text: string | ||
link: LinkItem[] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<script setup lang="ts"> | ||
import { ContentWrap } from '@/components/ContentWrap' | ||
import { useI18n } from '@/hooks/web/useI18n' | ||
import { IAgree } from '@/components/IAgree' | ||
const { t } = useI18n() | ||
</script> | ||
|
||
<template> | ||
<ContentWrap :title="t('router.iAgree')"> | ||
<IAgree | ||
:link="[ | ||
{ | ||
text: '《隐私政策》', | ||
url: 'https://www.baidu.com' | ||
} | ||
]" | ||
text="我同意《隐私政策》" | ||
/> | ||
</ContentWrap> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters