refactor(hooks): 状态管理模块拆分

This commit is contained in:
Soybean
2021-09-07 17:03:59 +08:00
parent 8601ce2ea1
commit 1128ae1870
23 changed files with 346 additions and 361 deletions

View File

@ -5,13 +5,14 @@
<script lang="ts" setup>
import { useLoadingBar, useDialog, useMessage, useNotification } from 'naive-ui';
function registerNaiveTool() {
// 挂载naive组件的方法至window, 以便在路由钩子函数和请求函数里面调用
function registerNaiveUiTools() {
window.$loadingBar = useLoadingBar();
window.$dialog = useDialog();
window.$message = useMessage();
window.$notification = useNotification();
}
registerNaiveTool();
registerNaiveUiTools();
</script>
<style scoped></style>

View File

@ -1,28 +0,0 @@
<template>
<div class="flex-center w-20px h-20px mx-6px mb-8px cursor-pointer rounded-2px" :style="{ backgroundColor: color }">
<icon-ic-outline-check
v-if="checked"
class="text-14px text-white"
:class="[isWhite ? 'text-gray-700' : 'text-white']"
/>
</div>
</template>
<script lang="ts" setup>
import { computed } from 'vue';
const props = defineProps({
color: {
type: String,
required: true
},
checked: {
type: Boolean,
default: false
}
});
const whiteColors = ['#ffffff', '#fff', 'rgb(255,255,255)'];
const isWhite = computed(() => whiteColors.includes(props.color));
</script>
<style scoped></style>

View File

@ -1,4 +1,3 @@
import AppProviderContent from './AppProviderContent/index.vue';
import ColorBlock from './ColorBlock/index.vue';
export { AppProviderContent, ColorBlock };
export { AppProviderContent };

View File

@ -1 +1 @@
export { AppProviderContent, ColorBlock } from './common';
export { AppProviderContent } from './common';