更新:增加“图书首页”功能

This commit is contained in:
2025-11-10 17:38:23 +08:00
parent 577e782cd8
commit e39f47855b
18 changed files with 1634 additions and 430 deletions

View File

@@ -1 +1,54 @@
/** @type {import('tailwindcss').Config} */
/** @type {import('tailwindcss').Config} */
module.exports = {
separator: '__', // 如果是小程序项目需要设置这一项,将 : 选择器替换成 __之后 hover:bg-red-500 将改为 hover__bg-red-500
corePlugins: {
// 预设样式
preflight: false, // 一般uniapp都有预设样式所以不需要tailwindcss的预设
// 以下功能小程序不支持
space: false, // > 子节点选择器
divideWidth: false,
divideColor: false,
divideStyle: false,
divideOpacity: false,
},
// 指定要处理的文件
content: [
'./pages/**/*.{vue,js}',
'./components/**/*.{vue,js}',
'./main.js',
'./App.vue',
'./index.html'
],
theme: {
// 字号,使用 App.vue 中的 --x-font-size 样式变量配置
fontSize(config){
const list = ['2xs','xs','sm','base','md','lg','xl','2xl','3xl'];
let result = {}
list.forEach(it=>{
result[it] = `var(--x-font-size-${it})`
})
return result
},
extend: {
// 间距tailwindcss中默认间距是rem单位可以统一设置为uniapp的rpx单位。
// 类似的设置根据项目需求自己调整一下就好了没必要去安装别人的预设其实主要是小程序不兼容的css比较多H5和App基本都直接兼容tailwindcss默认的预设
spacing(config) {
let result = { 0: '0' }
// 允许的数值大一些也无所谓最后打包tailwindcss会摇树优化未使用的样式并不会打包
for (let i = 1; i <= 300; i++) {
result[i] = `${i}rpx`
}
return result
},
// 增加颜色板现在主流UI组件库大都是采用css变量实现定制主题所以这里引用了全局的css变量这个css变量的定义位置可以在 App.vue 中 page{} 选择器下
// 其实tailwindcss只是一个css工具不必局限于它内部提供的东西灵活运用css变量这些特性完全可以整合出自己的生产力工具
colors:{
'primary': 'var(--x-color-primary)',
'tips' : 'var(--x-color-tips)'
},
},
},
plugins: [],
}