Skip to content

preferencePlugin - 偏好设置 ​

什么是 preferencePlugin? ​

preferencePlugin 是一个用于管理 Admin 中偏好配置的 pinia 插件。它提供了持久化、重置配置、复制配置的功能。

重置配置 ​

它给设置了 preference 的 store 提供了 $resetAllPreference 方法,你可以如下调用

vue
<script setup lang="ts">
import { useLayoutStore } from '@/store/use-layout-store'

const store = useLayoutStore()
</script>

<template>
  <n-button @click="store.$resetAllPreference">重置配置</n-button>
</template>

复制配置 ​

它给设置了 preference 的 store 提供了 $copyAllPreference 方法,你可以如下调用

vue
<script setup lang="ts">
import { useLayoutStore } from '@/store/use-layout-store'

const store = useLayoutStore()
</script>

<template>
  <n-button @click="store.$copyAllPreference">复制配置到剪切板</n-button>
</template>