Skip to content

Common Components

This document introduces other commonly used components in the Antdv Next Admin project besides Pro components.

Table of Contents


IconPicker

A popup component for selecting icons with search and category browsing support.

Location

src/components/IconPicker/

Basic Usage

vue
<template>
  <IconPicker v-model:value="iconName" />
</template>

<script setup>
import { ref } from 'vue'
import IconPicker from '@/components/IconPicker/index.vue'

const iconName = ref('HomeOutlined')
</script>

Props

PropertyTypeDefaultDescription
valuestring-Currently selected icon name
placeholderstring'Select icon'Placeholder text
readonlybooleanfalseRead only

Captcha

Provides multiple verification code types: slider, puzzle, rotate, and point selection.

Slider Captcha

vue
<template>
  <SliderCaptcha
    v-model:visible="visible"
    @success="handleSuccess"
    @fail="handleFail"
  />
</template>

<script setup>
import { ref } from 'vue'
import SliderCaptcha from '@/components/Captcha/SliderCaptcha.vue'

const visible = ref(false)

const handleSuccess = () => {
  message.success('Verification passed')
}

const handleFail = () => {
  message.error('Verification failed, please try again')
}
</script>

Editor

Rich text editor component based on TipTap.

Basic Usage

vue
<template>
  <Editor v-model="content" :height="400" />
</template>

<script setup>
import { ref } from 'vue'
import Editor from '@/components/Editor/index.vue'

const content = ref('<p>Initial content</p>')
</script>

Props

PropertyTypeDefaultDescription
modelValuestring''Editor content (HTML)
heightnumber300Editor height
placeholderstring'Enter content...'Placeholder text
disabledbooleanfalseDisabled state

Watermark

Used to add tamper-proof watermarks on pages.

Basic Usage

vue
<template>
  <Watermark content="Confidential" :fullscreen="true" />
</template>

<script setup>
import Watermark from '@/components/Watermark/index.vue'
</script>

Using Store

typescript
import { useWatermarkStore } from '@/stores/watermark'

const watermarkStore = useWatermarkStore()

// Set watermark
watermarkStore.setWatermark({
  content: `${userStore.userInfo?.username} - ${formatDate(new Date())}`,
})

// Clear watermark
watermarkStore.clearWatermark()

PermissionButton

Button component wrapped with permission checking.

Basic Usage

vue
<template>
  <PermissionButton permission="user.create">
    Add User
  </PermissionButton>
</template>

<script setup>
import PermissionButton from '@/components/Permission/PermissionButton.vue'
</script>

Props

PropertyTypeDefaultDescription
permissionstring | string[]-Required permission
allbooleanfalseRequire all permissions

Next Steps

Released under the MIT License.