补充组件描述, 起草 lay-config-provider 全局配置
This commit is contained in:
parent
dc03f2a65b
commit
3787e80ff0
@ -30,7 +30,7 @@ export default {
|
||||
::: demo
|
||||
|
||||
<template>
|
||||
<lay-block :nm="nm">引用区域的文字</lay-block>
|
||||
<lay-block nm="true">引用区域的文字</lay-block>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -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,8 +325,8 @@ export default {
|
||||
::: table
|
||||
|
||||
| 名称 | 描述 | 参数 |
|
||||
| ----- | -------- | ---- |
|
||||
| default | 默认内容 | -- |
|
||||
| ------- | -------- | ---- |
|
||||
| default | 默认内容 | -- |
|
||||
|
||||
:::
|
||||
|
||||
@ -335,10 +335,9 @@ export default {
|
||||
|
||||
::: table
|
||||
|
||||
|
||||
| 属性 | 描述 | 类型 | 默认值 | 可选值 |
|
||||
| ----------- | -------- | ------- | --------- | ----------------------------------|
|
||||
| - | - | - | - |
|
||||
| 属性 | 描述 | 类型 | 默认值 | 可选值 |
|
||||
| ---- | ---- | ---- | ------ | ------ |
|
||||
| - | - | - | - |
|
||||
|
||||
:::
|
||||
|
||||
@ -347,9 +346,9 @@ export default {
|
||||
|
||||
::: table
|
||||
|
||||
| 事件 | 描述 | 参数 |
|
||||
| ----- | -------- | ---- |
|
||||
| default | 默认内容 | -- |
|
||||
| 事件 | 描述 | 参数 |
|
||||
| ------- | -------- | ---- |
|
||||
| default | 默认内容 | -- |
|
||||
|
||||
:::
|
||||
|
||||
@ -357,4 +356,4 @@ export default {
|
||||
:::
|
||||
|
||||
::: previousNext button
|
||||
:::
|
||||
:::
|
||||
|
@ -1,6 +1,12 @@
|
||||
::: anchor
|
||||
:::
|
||||
|
||||
::: title 基本介绍
|
||||
:::
|
||||
|
||||
::: describe 最基础的卡片容器,可承载文字、列表、图片、段落,常用于后台概览页面。
|
||||
:::
|
||||
|
||||
::: title 基础使用
|
||||
:::
|
||||
|
||||
|
@ -1,6 +1,12 @@
|
||||
::: anchor
|
||||
:::
|
||||
|
||||
::: title 基本介绍
|
||||
:::
|
||||
|
||||
::: describe 内置 icon 图标选择组件, 常用于权限管理, 菜单定制。
|
||||
:::
|
||||
|
||||
::: title 基础使用
|
||||
:::
|
||||
|
||||
|
@ -1,6 +1,12 @@
|
||||
::: anchor
|
||||
:::
|
||||
|
||||
::: title 基本介绍
|
||||
:::
|
||||
|
||||
::: describe 提供极致的分页逻辑,既可轻松胜任异步分页,也可作为页面刷新式分页。
|
||||
:::
|
||||
|
||||
::: title 基础使用
|
||||
:::
|
||||
|
||||
|
@ -1,10 +1,15 @@
|
||||
::: anchor
|
||||
:::
|
||||
|
||||
::: title 基本介绍
|
||||
:::
|
||||
|
||||
::: describe 更灵活的布局方案。
|
||||
:::
|
||||
|
||||
::: title 基础使用
|
||||
:::
|
||||
|
||||
|
||||
::: demo
|
||||
|
||||
<template>
|
||||
|
@ -1,60 +1,62 @@
|
||||
<template>
|
||||
<lay-layout class="layui-layout-document">
|
||||
<lay-header
|
||||
><lay-logo style="box-shadow: 0 0px 2px 0 rgba(0, 0, 0, 0.15)">
|
||||
<img src="../assets/logo.png" />
|
||||
</lay-logo>
|
||||
<ul
|
||||
class="layui-nav layui-layout-left"
|
||||
style="margin-top: 0px; margin-bottom: 0px"
|
||||
>
|
||||
<li class="layui-nav-item">
|
||||
<router-link to="/zh-CN/index"> 首页 </router-link>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<router-link to="/zh-CN/guide"> 指南 </router-link>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<router-link to="/zh-CN/components"> 组件 </router-link>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<router-link to="/zh-CN/ecology"> 生态 </router-link>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<lay-form>
|
||||
<lay-search :datas="menus" />
|
||||
</lay-form>
|
||||
</li>
|
||||
</ul>
|
||||
<ul
|
||||
class="layui-nav layui-layout-right"
|
||||
style="margin-top: 0px; margin-bottom: 0px"
|
||||
>
|
||||
<li class="layui-nav-item">
|
||||
<a
|
||||
href="https://layui-vue.gitee.io/layui-vue-playground"
|
||||
target="_blank"
|
||||
>
|
||||
<lay-icon type="layui-icon-util" size="15px"></lay-icon>
|
||||
</a>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<a href="https://gitee.com/layui-vue">
|
||||
<lay-icon type="layui-icon-fonts-code" size="15px"></lay-icon>
|
||||
</a>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<a href="https://gitee.com/layui-vue/layui-vue/issues">
|
||||
<lay-icon type="layui-icon-chat" size="15px"></lay-icon>
|
||||
</a>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<a href="javascript:void(0)"> 0.3.7 </a>
|
||||
</li>
|
||||
</ul>
|
||||
</lay-header>
|
||||
<router-view></router-view>
|
||||
</lay-layout>
|
||||
<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)">
|
||||
<img src="../assets/logo.png" />
|
||||
</lay-logo>
|
||||
<ul
|
||||
class="layui-nav layui-layout-left"
|
||||
style="margin-top: 0px; margin-bottom: 0px"
|
||||
>
|
||||
<li class="layui-nav-item">
|
||||
<router-link to="/zh-CN/index"> 首页 </router-link>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<router-link to="/zh-CN/guide"> 指南 </router-link>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<router-link to="/zh-CN/components"> 组件 </router-link>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<router-link to="/zh-CN/ecology"> 生态 </router-link>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<lay-form>
|
||||
<lay-search :datas="menus" />
|
||||
</lay-form>
|
||||
</li>
|
||||
</ul>
|
||||
<ul
|
||||
class="layui-nav layui-layout-right"
|
||||
style="margin-top: 0px; margin-bottom: 0px"
|
||||
>
|
||||
<li class="layui-nav-item">
|
||||
<a
|
||||
href="https://layui-vue.gitee.io/layui-vue-playground"
|
||||
target="_blank"
|
||||
>
|
||||
<lay-icon type="layui-icon-util" size="15px"></lay-icon>
|
||||
</a>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<a href="https://gitee.com/layui-vue">
|
||||
<lay-icon type="layui-icon-fonts-code" size="15px"></lay-icon>
|
||||
</a>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<a href="https://gitee.com/layui-vue/layui-vue/issues">
|
||||
<lay-icon type="layui-icon-chat" size="15px"></lay-icon>
|
||||
</a>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<a href="javascript:void(0)"> 0.3.7 </a>
|
||||
</li>
|
||||
</ul>
|
||||
</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,
|
||||
|
@ -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'
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -8,7 +8,7 @@ export default {
|
||||
import "./index.less";
|
||||
|
||||
const props = defineProps<{
|
||||
nm?: boolean;
|
||||
nm?: boolean | string;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
|
@ -5,4 +5,4 @@ Component.install = (app: App) => {
|
||||
app.component(Component.name, Component);
|
||||
};
|
||||
|
||||
export default Component;
|
||||
export default Component;
|
@ -1,19 +1,44 @@
|
||||
<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>
|
||||
|
||||
<template>
|
||||
<div class="lay-config-provider">
|
||||
<slot></slot>
|
||||
</div>
|
||||
<div class="lay-config-provider">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</template>
|
Loading…
Reference in New Issue
Block a user