chore: 优化 example 打包

This commit is contained in:
就眠儀式 2022-04-02 06:34:14 +08:00
parent 4dd7f5ed95
commit 90bb7f7fc5
15 changed files with 127 additions and 29 deletions

View File

@ -217,7 +217,7 @@ export default {
| default | 默认插槽 | -- |
| header | 头部插槽 | -- |
| body | 内容插槽 | -- |
| extra | 扩展插槽 | -- |
:::

View File

@ -53,6 +53,33 @@ export default {
:::
::: title 扩展插槽
:::
::: demo
<template>
<lay-empty description="刷新试试">
<template #extra>
<lay-button>刷新页面</lay-button>
</template>
</lay-empty>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
return {
}
}
}
</script>
:::
::: title Empty 属性
:::
@ -64,7 +91,16 @@ export default {
:::
::: title Empty 插槽
:::
::: table
| 属性 | 描述 | 可选值 |
| ----------- | -------- | ------ |
| extra | 扩展插槽 | -- |
:::
::: previousNext empty
:::

View File

@ -14,7 +14,7 @@
<template>
<lay-exception status="401" title="401" describe="暂无相关权限">
<template #action>
<template #extra>
<lay-button>刷新</lay-button>
<lay-button type="primary">返回</lay-button>
</template>
@ -42,7 +42,7 @@ export default {
<template>
<lay-exception status="403" title="403" describe="暂无相关权限">
<template #action>
<template #extra>
<lay-button>刷新</lay-button>
<lay-button type="primary">返回</lay-button>
</template>
@ -70,7 +70,7 @@ export default {
<template>
<lay-exception status="404" title="404" describe="跳转页面失败">
<template #action>
<template #extra>
<lay-button>刷新</lay-button>
<lay-button type="primary">返回</lay-button>
</template>
@ -99,7 +99,7 @@ export default {
<template>
<lay-exception status="500" title="500" describe="服务发生错误">
<template #action>
<template #extra>
<lay-button>刷新</lay-button>
<lay-button type="primary">返回</lay-button>
</template>
@ -140,7 +140,7 @@ export default {
| 属性 | 描述 | 可选值 |
| ----------- | -------- | ------ |
| action | 操作 | -- |
| extra | 操作 | -- |
:::

View File

@ -53,6 +53,34 @@ export default {
:::
::: title 完整
:::
::: demo 使用 `lay-result` 标签, 创建一个结果页面
<template>
<lay-result status="failure">
<template #extra>
<lay-button type="primary">再来一次</lay-button>
<lay-button >返回首页</lay-button>
</template>
</lay-result>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
return {
}
}
}
</script>
:::
::: title Result 属性
:::
@ -74,7 +102,7 @@ export default {
| 属性 | 描述 | 可选值 |
| ----------- | -------- | ------ |
| content | 内容 | -- |
| action | 操作 | -- |
| extra | 扩展 | -- |
:::

View File

@ -17,6 +17,9 @@
<h3>1.0.0 <span class="layui-badge-rim">2022-04-01</span></h3>
<ul>
<li>[重要] 修订 version 为 1.0.0。</li>
<li>[新增] empty 组件 extra 插槽, 支持扩展内容。</li>
<li>[新增] result 组件 extra 插槽, 支持扩展内容。</li>
<li>[新增] exception 组件 extra 插槽, 支持扩展内容。</li>
<li>[新增] switch 组件 onswitch-value 属性, 默认为 true。</li>
<li>[新增] switch 组件 unswitch-value 属性, 默认为 false。</li>
<li>[新增] date-picker 组件 time 属性, 支持 时 分 秒 选择。</li>

View File

@ -34,6 +34,18 @@ onMounted(() => {
--docsearch-searchbox-background: rgba(255, 255, 255, 0.02);
--docsearch-searchbox-focus-background: rgba(255, 255, 255, 0.02);
--docsearch-container-background: rgba(0, 0, 0, 0.1);
--docsearch-searchbox-shadow: inset 0 0 0 1px var(--docsearch-primary-color);
}
.DocSearch-Button{
width: 150px;
border-radius: 50px;
}
.DocSearch-Button-Container {
padding-left: 2px;
}
.DocSearch-Button-Placeholder {
padding-left: 8px;
}
.DocSearch-Button,
@ -55,4 +67,8 @@ onMounted(() => {
.DocSearch-Button-Placeholder {
color: rgba(0, 0, 0, 0.6);
}
.DocSearch-Button-Keys {
display: none;
}
</style>

View File

@ -12,5 +12,16 @@ export default defineConfig({
define: {
'import.meta.env.LAYUI_VUE_VERSION': JSON.stringify(pkg.version),
},
build: {
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes("node_modules")) {
return id.toString().split("node_modules/")[1].split("/")[0].toString();
}
}
}
}
},
plugins,
})

View File

@ -1,6 +1,6 @@
{
"name": "@layui/layui-vue",
"version": "1.0.0-alpha.2",
"version": "1.0.0-alpha.4",
"author": "就眠儀式",
"license": "MIT",
"description": "a component library for Vue 3 base on layui-vue",

View File

@ -55,7 +55,7 @@ export default (): UserConfigExport => {
entryFileNames: ({ name }) => {
return name === 'index' ? 'index.js' : '[name]/index.js'
},
assetFileNames: '[name]/index.css'
assetFileNames: '[name]/index.css',
},
external: ['vue', 'vue-router']
}

View File

@ -255,14 +255,7 @@
</template>
<script lang="ts" setup>
import {
ref,
watch,
computed,
defineProps,
defineEmits,
onMounted,
} from "vue";
import { ref, watch, computed, defineProps, defineEmits, onMounted } from "vue";
import moment from "moment";
import LayIcon from "../icon/index";
@ -300,7 +293,11 @@ const MONTH_NAME = [
"12月",
];
const hms = ref({ hh: moment(props.modelValue).hour(), mm: moment(props.modelValue).minute(), ss: moment(props.modelValue).second() });
const hms = ref({
hh: moment(props.modelValue).hour(),
mm: moment(props.modelValue).minute(),
ss: moment(props.modelValue).second(),
});
const els = [
{ count: 24, type: "hh" },
{ count: 60, type: "mm" },
@ -324,10 +321,10 @@ watch(
);
onMounted(() => {
hms.value.hh = moment(props.modelValue).hour();
hms.value.mm = moment(props.modelValue).minute();
hms.value.ss = moment(props.modelValue).second();
})
hms.value.hh = moment(props.modelValue).hour();
hms.value.mm = moment(props.modelValue).minute();
hms.value.ss = moment(props.modelValue).second();
});
//
const dateValue = computed<string>(() => {

View File

@ -20,3 +20,7 @@
.layui-empty-description {
margin: 0;
}
.layui-empty-extra {
margin-top: 30px;
}

View File

@ -27,5 +27,8 @@ const props = withDefaults(defineProps<LayEmptyProps>(), {
<div class="layui-empty-description">
{{ description }}
</div>
<div class="layui-empty-extra">
<slot name="extra"></slot>
</div>
</div>
</template>

View File

@ -35,8 +35,8 @@ const props = withDefaults(defineProps<LayDropdownProps>(), {
<div class="layui-exception-details-content">
<div class="layui-exception-details-title">{{ title }}</div>
<div class="layui-exception-details-describe">{{ describe }}</div>
<div class="layui-exception-details-operate">
<slot name="action"></slot>
<div class="layui-exception-details-extra">
<slot name="extra"></slot>
</div>
</div>
</div>

View File

@ -26,10 +26,10 @@
margin-top: 20px;
width: 80%;
border-radius: 10px;
background-color: whitesmoke;
background-color: white;
margin-left: 10%;
}
.result .action {
.result .extra {
padding-top: 10px;
border-top: 1px whitesmoke solid;
margin-top: 25px;

View File

@ -71,8 +71,8 @@ const props = withDefaults(defineProps<LayResultProps>(), {
<div class="content">
<slot name="content"></slot>
</div>
<div class="action">
<slot name="action"></slot>
<div class="extra">
<slot name="extra"></slot>
</div>
</div>
</template>