补充组件描述, 起草 lay-config-provider 全局配置

This commit is contained in:
就眠儀式 2022-02-08 11:36:36 +08:00
parent dc03f2a65b
commit 3787e80ff0
12 changed files with 135 additions and 83 deletions

View File

@ -30,7 +30,7 @@ export default {
::: demo
<template>
<lay-block :nm="nm">引用区域的文字</lay-block>
<lay-block nm="true">引用区域的文字</lay-block>
</template>
<script>

View File

@ -307,7 +307,7 @@ export default {
::: table
| 属性 | 描述 | 类型 | 默认值 | 可选值 |
| ----------- | -------- | ------- | --------- | ----------------------------------|
| ----------- | -------- | ------- | --------- | ---------------------------------- |
| type | 主题 | string | `primary` | `primary` `normal` `warm` `danger` |
| size | 尺寸 | string | -- | `lg` `sm` `xs` |
| fluid | 最大化 | boolean | `false` | `true` `false` |
@ -325,7 +325,7 @@ export default {
::: table
| 名称 | 描述 | 参数 |
| ----- | -------- | ---- |
| ------- | -------- | ---- |
| default | 默认内容 | -- |
:::
@ -335,9 +335,8 @@ export default {
::: table
| 属性 | 描述 | 类型 | 默认值 | 可选值 |
| ----------- | -------- | ------- | --------- | ----------------------------------|
| ---- | ---- | ---- | ------ | ------ |
| - | - | - | - |
:::
@ -348,7 +347,7 @@ export default {
::: table
| 事件 | 描述 | 参数 |
| ----- | -------- | ---- |
| ------- | -------- | ---- |
| default | 默认内容 | -- |
:::

View File

@ -1,6 +1,12 @@
::: anchor
:::
::: title 基本介绍
:::
::: describe 最基础的卡片容器,可承载文字、列表、图片、段落,常用于后台概览页面。
:::
::: title 基础使用
:::

View File

@ -1,6 +1,12 @@
::: anchor
:::
::: title 基本介绍
:::
::: describe 内置 icon 图标选择组件, 常用于权限管理, 菜单定制。
:::
::: title 基础使用
:::

View File

@ -1,6 +1,12 @@
::: anchor
:::
::: title 基本介绍
:::
::: describe 提供极致的分页逻辑,既可轻松胜任异步分页,也可作为页面刷新式分页。
:::
::: title 基础使用
:::

View File

@ -1,10 +1,15 @@
::: anchor
:::
::: title 基本介绍
:::
::: describe 更灵活的布局方案。
:::
::: title 基础使用
:::
::: demo
<template>

View File

@ -1,4 +1,5 @@
<template>
<lay-config-provider :theme="theme">
<lay-layout class="layui-layout-document">
<lay-header
><lay-logo style="box-shadow: 0 0px 2px 0 rgba(0, 0, 0, 0.15)">
@ -55,6 +56,7 @@
</lay-header>
<router-view></router-view>
</lay-layout>
</lay-config-provider>
</template>
<script>
import { ref, watch } from "vue";
@ -65,7 +67,6 @@ export default {
const route = useRoute();
const router = useRouter();
const currentPath = ref("/zh-CN/guide");
const theme = ref(false);
const menus = [];
@ -90,6 +91,10 @@ export default {
router.push(menu.path);
};
const theme = {
"@global-primary-color":"red"
}
return {
menus,
theme,

View File

@ -18,7 +18,7 @@ export default function createContainer(
const token = tokens[idx]
const info = token.info.trim().slice(klass.length).trim()
if (token.nesting === 1) {
return `<lay-block style="margin-left:8px;margin-bottom:40px;">${info}`
return `<lay-block style="margin-left:0px;margin-right:0px;margin-top:20px;margin-bottom:40px;">${info}`
} else {
return '</lay-block>\n'
}

View File

@ -38,7 +38,7 @@
"async-validator": "^4.0.7",
"countup.js": "^2.0.8",
"evtd": "^0.2.3",
"vue": "^3.2.29",
"vue": "^3.2.30",
"vue-router": "^4.0.12"
},
"devDependencies": {
@ -52,8 +52,8 @@
"@typescript-eslint/eslint-plugin": "^5.8.0",
"@typescript-eslint/parser": "^5.8.0",
"@vitejs/plugin-vue": "^1.9.3",
"@vue/compiler-sfc": "^3.2.29",
"@vue/server-renderer": "^3.2.29",
"@vue/compiler-sfc": "^3.2.30",
"@vue/server-renderer": "^3.2.30",
"commitizen": "^4.2.4",
"cz-conventional-changelog": "3.3.0",
"escape-html": "^1.0.3",

View File

@ -8,7 +8,7 @@ export default {
import "./index.less";
const props = defineProps<{
nm?: boolean;
nm?: boolean | string;
}>();
</script>

View File

@ -1,14 +1,39 @@
<script lang="ts">
import { watch } from '@vue/runtime-core';
export default {
name: "lay-config-provider"
}
name: "lay-config-provider",
};
</script>
<script setup lang="ts">
// ( less api )
export interface LayConfigProviderProps {
theme?: object;
}
// ( i18n )
const props = withDefaults(defineProps<LayConfigProviderProps>(),
{
}
);
const changeTheme = (vars: any) => {
// @ts-ignore
if (!window.less || !window.less.modifyVars) {
return;
}
// @ts-ignore
window.less.modifyVars(vars).then((res) => {
console.log(res);
}).catch((res: any) => {
console.log(res);
});
};
watch(() => props.theme, (vars) => {
changeTheme(vars);
},{immediate: true})
</script>