Fork自 浩星 / 基于vue的头像自动生成器
import { computed } from 'vue' import { useStore } from '@/store' import { SET_AVATAR_OPTION } from '@/store/mutation-type'
import type { AvatarOption } from '@/types'
export default function useAvatarOption() { const store = useStore()
const avatarOption = computed(() => store.history.present)
const setAvatarOption = (newOption: AvatarOption) => {
store[SET_AVATAR_OPTION](newOption)
} return [avatarOption, setAvatarOption] as const }