图书项目要点

2024-08-22 20:36
文章标签 项目 图书 要点

本文主要是介绍图书项目要点,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

一、搭建项目

使用tarojs/cli进行搭建

taro init [项目名]

二、具体页面

页面声明:

在【app.config.ts】中对主页面进行声明:组件页面可以不用声明

pages: ["pages/index/index",'pages/user/index','pages/book/index',],

tabbar制作:

在【app.config.ts】中写入代码:

tabBar: {color: '#333',selectedColor: '#1cbbb4',backgroundColor: '#fff',borderStyle: 'black',list: [{pagePath: 'pages/index/index',text: '首页',iconPath: './assets/tabbar/home.png',selectedIconPath: './assets/tabbar/home_active.png'},{pagePath: 'pages/book/index',text: '书架',iconPath: './assets/tabbar/book.png',selectedIconPath: './assets/tabbar/book_active.png'},{pagePath: 'pages/user/index',text: '我的',iconPath: './assets/tabbar/mine2.png',selectedIconPath: './assets/tabbar/mine2_active.png'},]},
};

【我的】:

页面效果:

【user/index.tsx】页面代码:

import { View, Text, Button, Image } from "@tarojs/components";import './index.less'
import AutorBar from "@/components/AutorBar";
import Line from "@/components/Line";
import TextBar from "@/components/TextBar";const list = [{ title: '我的收藏', icon: require('../../assets/collect.png') },{ title: '借阅记录', icon: require('../../assets/read.png') },{ title: '留言板', icon: require('../../assets/message.png') },
]const User = () => {return (<View className="wrapper"><AutorBar></AutorBar><Line></Line><View className="title"> 最近阅读 </View><Line></Line><View>{list.map((item, index) => <TextBar {...item}></TextBar>)}</View></View>);
};export default User;

【user/index.less】样式文件:

page {background-color: white;padding         : 14px;box-sizing      : border-box;color           : #333;}.wrapper {display       : flex;flex-direction: column;}.title{padding: 20px 0;font-weight: bold;}

【user/index.config.ts】文件

export default {navigationBarTitleText: '图书',enableShareAppMessage: true,};

【书架页面】:

效果如下:

【book/index.tsx】:

import { View, Text, Button, Image } from "@tarojs/components";import './index.less'
import HistoryBar from "@/components/HistoryBar";const bookIndex = require('../../data/detail_400000.json')
const bookList = require('../../data/books_1500000.json')const Book = () => {console.log(bookIndex, 'bookIndex')return (<View className="wrapper"><View className="title"> 热门推荐 </View><HistoryBar bookList={bookList}></HistoryBar></View>);
};export default Book;

【book/index.less】:

page {background-color: white;padding         : 14px;box-sizing      : border-box;color           : #333;background-color: #f6f6f6;
}.wrapper {display       : flex;flex-direction: column;
}.title{padding: 20px 0;font-weight: bold;}

【book/index.config.ts】:

export default {navigationBarTitleText: '图书',enableShareAppMessage: true,};

【主页】效果如下:

【index/index.tsx】

import React, { useCallback } from "react";
import { View, Text, Button, Image } from "@tarojs/components";
import { useEnv, useNavigationBar, useModal, useToast } from "taro-hooks";import './index.less'
import ComBar from "src/components/ComBar";
import Search from "@/components/Search";const Index = () => {return (<View className="wrapper"><Search></Search><ComBar></ComBar></View>);
};export default Index;

【index/index.less】:

page {background-color: white;padding         : 14px;box-sizing      : border-box;color           : #333;
}.cardList{display: flex;flex-wrap: wrap;}

【Combar】组件

import { ScrollView, View, Image, Text } from "@tarojs/components"import './index.less'const list =[{ title: '精品推荐', icon: require('./images/icon0.png') },{ title: '历史', icon: require('./images/icon1.png')},{ title: '文学', icon: require('./images/icon2.png') },{ title: '艺术', icon: require('./images/icon3.png') },{ title: '人物传记', icon: require('./images/icon4.png') },{ title: '自然科学', icon: require('./images/icon5.png') },{ title: '国外读物', icon: require('./images/icon6.png') }]const ComBar = () => {return (<ScrollView className="combar" scrollX >{list.map(item => <View key={item.title} className="combarItem"><View className="combarItemView"><Image className="combarItemImage" src={item.icon}></Image></View><View className="combarItemText">{item.title}</View></View>)}</ScrollView>)
}export default ComBar

整体效果:

这篇关于图书项目要点的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1097327

相关文章

一文教你如何将maven项目转成web项目

《一文教你如何将maven项目转成web项目》在软件开发过程中,有时我们需要将一个普通的Maven项目转换为Web项目,以便能够部署到Web容器中运行,本文将详细介绍如何通过简单的步骤完成这一转换过程... 目录准备工作步骤一:修改​​pom.XML​​1.1 添加​​packaging​​标签1.2 添加

tomcat多实例部署的项目实践

《tomcat多实例部署的项目实践》Tomcat多实例是指在一台设备上运行多个Tomcat服务,这些Tomcat相互独立,本文主要介绍了tomcat多实例部署的项目实践,具有一定的参考价值,感兴趣的可... 目录1.创建项目目录,测试文China编程件2js.创建实例的安装目录3.准备实例的配置文件4.编辑实例的

springboot集成Deepseek4j的项目实践

《springboot集成Deepseek4j的项目实践》本文主要介绍了springboot集成Deepseek4j的项目实践,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价... 目录Deepseek4j快速开始Maven 依js赖基础配置基础使用示例1. 流式返回示例2. 进阶

SpringBoot项目启动报错"找不到或无法加载主类"的解决方法

《SpringBoot项目启动报错找不到或无法加载主类的解决方法》在使用IntelliJIDEA开发基于SpringBoot框架的Java程序时,可能会出现找不到或无法加载主类com.example.... 目录一、问题描述二、排查过程三、解决方案一、问题描述在使用 IntelliJ IDEA 开发基于

SpringBoot项目使用MDC给日志增加唯一标识的实现步骤

《SpringBoot项目使用MDC给日志增加唯一标识的实现步骤》本文介绍了如何在SpringBoot项目中使用MDC(MappedDiagnosticContext)为日志增加唯一标识,以便于日... 目录【Java】SpringBoot项目使用MDC给日志增加唯一标识,方便日志追踪1.日志效果2.实现步

Ubuntu中Nginx虚拟主机设置的项目实践

《Ubuntu中Nginx虚拟主机设置的项目实践》通过配置虚拟主机,可以在同一台服务器上运行多个独立的网站,本文主要介绍了Ubuntu中Nginx虚拟主机设置的项目实践,具有一定的参考价值,感兴趣的可... 目录简介安装 Nginx创建虚拟主机1. 创建网站目录2. 创建默认索引文件3. 配置 Nginx4

SpringBoot项目启动错误:找不到或无法加载主类的几种解决方法

《SpringBoot项目启动错误:找不到或无法加载主类的几种解决方法》本文主要介绍了SpringBoot项目启动错误:找不到或无法加载主类的几种解决方法,具有一定的参考价值,感兴趣的可以了解一下... 目录方法1:更改IDE配置方法2:在Eclipse中清理项目方法3:使用Maven命令行在开发Sprin

Nginx实现高并发的项目实践

《Nginx实现高并发的项目实践》本文主要介绍了Nginx实现高并发的项目实践,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧... 目录使用最新稳定版本的Nginx合理配置工作进程(workers)配置工作进程连接数(worker_co

Vue项目的甘特图组件之dhtmlx-gantt使用教程和实现效果展示(推荐)

《Vue项目的甘特图组件之dhtmlx-gantt使用教程和实现效果展示(推荐)》文章介绍了如何使用dhtmlx-gantt组件来实现公司的甘特图需求,并提供了一个简单的Vue组件示例,文章还分享了一... 目录一、首先 npm 安装插件二、创建一个vue组件三、业务页面内 引用自定义组件:四、dhtmlx

SpringBoot项目注入 traceId 追踪整个请求的日志链路(过程详解)

《SpringBoot项目注入traceId追踪整个请求的日志链路(过程详解)》本文介绍了如何在单体SpringBoot项目中通过手动实现过滤器或拦截器来注入traceId,以追踪整个请求的日志链... SpringBoot项目注入 traceId 来追踪整个请求的日志链路,有了 traceId, 我们在排