更新 exception 组件

This commit is contained in:
就眠儀式 2022-01-29 23:07:16 +08:00
parent 5a1f43a9d8
commit de92a5fd2e
7 changed files with 381 additions and 1026 deletions

View File

@ -1,6 +1,34 @@
::: anchor ::: anchor
::: :::
::: title 401
:::
::: demo 使用 `lay-exception` 标签, 创建一个异常页面
<template>
<lay-exception status="401" title="401" describe="暂无相关权限">
<template #action>
<lay-button>刷新</lay-button>
<lay-button type="primary">返回</lay-button>
</template>
</lay-exception>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
return {
}
}
}
</script>
:::
::: title 403 ::: title 403
::: :::

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 193 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 195 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 195 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 209 KiB

View File

@ -4,11 +4,13 @@
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
> div { > div {
width: 200px;
height: 200px; height: 200px;
background-size: 100% 100%; background-size: 100% 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.error-401 {
background-image: url(./image/401.svg);
}
.error-403 { .error-403 {
background-image: url(./image/403.svg); background-image: url(./image/403.svg);
} }
@ -21,16 +23,17 @@
} }
.layui-exception-details{ .layui-exception-details{
.layui-exception-details-content { .layui-exception-details-content {
margin-left: 100px;
.layui-exception-details-title{ .layui-exception-details-title{
font-size: 68px; font-size: 60px;
color: #434e59; color: #434e59;
margin-bottom: 24px; margin-bottom: 24px;
font-weight: 600; font-weight: 600;
} }
.layui-exception-details-describe{ .layui-exception-details-describe{
font-size: 20px; font-size: 18px;
color: rgba(0, 0, 0, .45); color: rgba(0, 0, 0, .45);
margin-bottom: 16px; margin-bottom: 26px;
} }
} }
width: 50%; width: 50%;

View File

@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { useSlots } from '@vue/runtime-core';
export default { export default {
name: "LayException" name: "LayException"
} }
@ -8,22 +9,27 @@ import "./index.less";
export interface LayDropdownProps { export interface LayDropdownProps {
title?: string, title?: string,
status?: '403' | '404' | '500', status?: '401' | '403' | '404' | '500',
describe?: string describe?: string
} }
const slot = useSlots();
const props = withDefaults(defineProps<LayDropdownProps>(), { const props = withDefaults(defineProps<LayDropdownProps>(), {
title: "Exception", title: "Exception",
describe: "describe" describe: "describe"
}); });
</script> </script>
<template> <template>
<div class="layui-exception"> <div class="layui-exception">
<div class="layui-exception-image"> <div class="layui-exception-image">
<div v-if="status=='403'" class="error-403" /> <slot name="image" v-if="slot.default"></slot>
<div v-if="status=='404'" class="error-404" /> <template v-else>
<div v-if="status=='500'" class="error-500" /> <div v-if="status=='401'" class="error-401" />
<div v-if="status=='403'" class="error-403" />
<div v-if="status=='404'" class="error-404" />
<div v-if="status=='500'" class="error-500" />
</template>
</div> </div>
<div class="layui-exception-details"> <div class="layui-exception-details">
<div class="layui-exception-details-content"> <div class="layui-exception-details-content">