build: 删除 build.less.ts 文件

This commit is contained in:
就眠儀式 2022-02-25 10:10:33 +08:00
parent 18990ef594
commit 30a1a33b06
5 changed files with 68 additions and 34 deletions

View File

@ -231,6 +231,57 @@ export default {
:::
::: title 菜单折叠
:::
::: demo
<template>
<lay-switch v-model="collapse"></lay-switch>
<br/>
<br/>
<lay-menu v-model:selectedKey="selectedKey" v-model:tree="isTree" v-model:openKeys="openKeys6" :collapse="collapse">
<lay-menu-item title="首页" id="1"></lay-menu-item>
<lay-menu-item title="用户" id="2"></lay-menu-item>
<lay-menu-item title="角色" id="3"></lay-menu-item>
<lay-sub-menu title="目录" id="7">
<lay-menu-item title="菜单1" id="8"></lay-menu-item>
<lay-menu-item title="菜单2" id="9"></lay-menu-item>
<lay-sub-menu title="菜单3" id="10">
<lay-menu-item title="菜单3-1" id="11"></lay-menu-item>
<lay-menu-item title="菜单3-2" id="12"></lay-menu-item>
<lay-sub-menu title="菜单3-3" id="13">
<lay-menu-item title="菜单3-3-1" id="14"></lay-menu-item>
<lay-menu-item title="菜单3-3-2" id="15"></lay-menu-item>
<lay-menu-item title="菜单3-3-3" id="16"></lay-menu-item>
</lay-sub-menu>
</lay-sub-menu>
</lay-sub-menu>
</lay-menu>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
const selectedKey = ref("5")
const openKeys6 = ref(["7"])
const collapse = ref(true)
const isTree = ref(true)
return {
selectedKey,
openKeys6,
colapse,
isTree
}
}
}
</script>
:::
::: title Menu 属性
:::

View File

@ -22,10 +22,9 @@
},
"scripts": {
"dev": "vite example",
"build": "npm run build:all && npm run build:es && npm run build:less && npm run build:types && npm run build:example",
"build": "npm run build:all && npm run build:es && npm run build:types && npm run build:example",
"build:es": "vite build --emptyOutDir --config ./script/build.es.ts",
"build:all": "vite build --emptyOutDir --config ./script/build.all.ts",
"build:less": "node ./script/build.less.ts",
"build:types": "rimraf types && tsc -d",
"build:example": "vite build example",
"lint:eslint": "eslint 'src/**/*.{vue,ts,tsx}' --fix",

View File

@ -1,32 +0,0 @@
/**
* merge less file
* <p>
*/
var fs = require('fs');
var { resolve } = require('path');
// @ts-ignore
const inputDir = resolve(process.cwd(), './src/component')
// @ts-ignore
const inputsArray = fs.readdirSync(inputDir).filter((name) => {
const componentDir = resolve(inputDir, name)
const isDir = fs.lstatSync(componentDir).isDirectory()
return isDir && fs.readdirSync(componentDir).includes('index.ts')
})
var content = fs.readFileSync("./src/theme/variable.less").toString() + '\n\n';
content += fs.readFileSync("./src/theme/index.less").toString() + '\n\n';
inputsArray.forEach(function (f) {
var path = "./src/component/" + f + "/index.less";
fs.exists(path, function (exists) {
if (exists) {
var c = fs.readFileSync(path);
content += c.toString() + '\n\n';
// @ts-ignore
content = content.replaceAll(/\@import.*?\;/g, "");
fs.writeFileSync('./lib/index.less', content);
}
});
})

View File

@ -159,6 +159,19 @@
text-align: center;
}
//
.layui-nav.layui-nav-collapse {
width: 60px;
span {
display: none;
}
.layui-nav-more {
display: none;
}
}
.layui-nav-tree {
width: 200px;
padding: 0;

View File

@ -15,6 +15,7 @@ export interface LayMenuProps {
theme?: string;
inverted?: boolean | string;
level?: boolean | string;
collapse?: boolean | string
}
const emit = defineEmits(["update:selectedKey", "update:openKeys"]);
@ -26,6 +27,7 @@ const props = withDefaults(defineProps<LayMenuProps>(), {
theme: "dark",
inverted: false,
level: false,
collapse: false
});
const isTree = computed(() => props.tree);
@ -61,6 +63,7 @@ provide("openKeys", openKeys);
inverted ? 'inverted' : '',
tree ? 'layui-nav-tree' : '',
theme === 'dark' ? 'layui-nav-dark' : 'layui-nav-light',
collapse ? 'layui-nav-collapse':''
]"
>
<slot></slot>