speed fix
This commit is contained in:
parent
b771d209ee
commit
f58a5106eb
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "axp-ui",
|
"name": "axp-ui",
|
||||||
"descriiption": "My helper ui lib",
|
"descriiption": "My helper ui lib",
|
||||||
"version": "1.6.2",
|
"version": "1.6.3",
|
||||||
"homepage": "https://antoxahub.ru/antoxa/axp-ui",
|
"homepage": "https://antoxahub.ru/antoxa/axp-ui",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -11,4 +11,4 @@ export enum ColorEnum {
|
|||||||
|
|
||||||
export type TColor = keyof typeof ColorEnum
|
export type TColor = keyof typeof ColorEnum
|
||||||
|
|
||||||
export const colors = Object.keys(ColorEnum)
|
export const colors = <TColor[]>Object.keys(ColorEnum)
|
||||||
|
@ -51,7 +51,7 @@ const title = computed(() => {
|
|||||||
const load = ref(false)
|
const load = ref(false)
|
||||||
watch(load, val => emit('update:load', val))
|
watch(load, val => emit('update:load', val))
|
||||||
|
|
||||||
const messages: Ref<TNotificationItem[]> = ref(props.messages || [])
|
const messages = ref<TNotificationItem[]>(props.messages || [])
|
||||||
watch(
|
watch(
|
||||||
() => props.messages,
|
() => props.messages,
|
||||||
val => (messages.value = val || [])
|
val => (messages.value = val || [])
|
||||||
@ -101,7 +101,7 @@ const submitHandler = async () => {
|
|||||||
|
|
||||||
// Etc.
|
// Etc.
|
||||||
const getColorMessage = (item: TNotificationItem) => {
|
const getColorMessage = (item: TNotificationItem) => {
|
||||||
return colors.includes(item.code) ? item.code : 'error'
|
return colors.find(e => e === item.code) ?? 'error'
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ const getColorMessage = (item: TNotificationItem) => {
|
|||||||
<ui-alert
|
<ui-alert
|
||||||
v-for="item in messages"
|
v-for="item in messages"
|
||||||
:value="item.text"
|
:value="item.text"
|
||||||
:color="colors.includes(item.code) ? item.code : 'error'"
|
:color="getColorMessage(item)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-form-body">
|
<div class="ui-form-body">
|
||||||
|
@ -1,21 +1,29 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
export type TTheme = 'light' | 'dark'
|
||||||
|
</script>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import UiIcon from './Icon.vue'
|
import UiIcon from './Icon.vue'
|
||||||
|
|
||||||
// Props.
|
// Props.
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
dark?: boolean
|
modelValue?: TTheme
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
// Emits.
|
// Emits.
|
||||||
const emit = defineEmits<{ (e: 'update:dark', v: boolean): void }>()
|
const emit = defineEmits<{ (e: 'update:modelValue', v: TTheme): void }>()
|
||||||
|
|
||||||
|
// Handlers.
|
||||||
|
const clickHandler = ({}: PointerEvent) =>
|
||||||
|
emit('update:modelValue', props.modelValue === 'dark' ? 'light' : 'dark')
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="ui-toggle-theme">
|
<div class="ui-toggle-theme">
|
||||||
<ui-icon
|
<ui-icon
|
||||||
:name="props.dark ? 'moon' : 'sun'"
|
|
||||||
@click="emit('update:dark', !props.dark)"
|
|
||||||
title="Переключить тему"
|
title="Переключить тему"
|
||||||
|
:name="props.modelValue === 'dark' ? 'moon' : 'sun'"
|
||||||
|
@click="clickHandler"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -2,6 +2,7 @@ import type { Config } from 'tailwindcss'
|
|||||||
|
|
||||||
const config: Config = {
|
const config: Config = {
|
||||||
content: ['./src/components/**/*.vue'],
|
content: ['./src/components/**/*.vue'],
|
||||||
|
darkMode: 'class',
|
||||||
theme: {
|
theme: {
|
||||||
extend: {
|
extend: {
|
||||||
colors: {
|
colors: {
|
||||||
|
Loading…
Reference in New Issue
Block a user