图书项目要点

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

相关文章

springboot项目中整合高德地图的实践

《springboot项目中整合高德地图的实践》:本文主要介绍springboot项目中整合高德地图的实践,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一:高德开放平台的使用二:创建数据库(我是用的是mysql)三:Springboot所需的依赖(根据你的需求再

一文详解如何在idea中快速搭建一个Spring Boot项目

《一文详解如何在idea中快速搭建一个SpringBoot项目》IntelliJIDEA作为Java开发者的‌首选IDE‌,深度集成SpringBoot支持,可一键生成项目骨架、智能配置依赖,这篇文... 目录前言1、创建项目名称2、勾选需要的依赖3、在setting中检查maven4、编写数据源5、开启热

SpringBoot项目配置logback-spring.xml屏蔽特定路径的日志

《SpringBoot项目配置logback-spring.xml屏蔽特定路径的日志》在SpringBoot项目中,使用logback-spring.xml配置屏蔽特定路径的日志有两种常用方式,文中的... 目录方案一:基础配置(直接关闭目标路径日志)方案二:结合 Spring Profile 按环境屏蔽关

MySQL版本问题导致项目无法启动问题的解决方案

《MySQL版本问题导致项目无法启动问题的解决方案》本文记录了一次因MySQL版本不一致导致项目启动失败的经历,详细解析了连接错误的原因,并提供了两种解决方案:调整连接字符串禁用SSL或统一MySQL... 目录本地项目启动报错报错原因:解决方案第一个:第二种:容器启动mysql的坑两种修改时区的方法:本地

springboot项目中使用JOSN解析库的方法

《springboot项目中使用JOSN解析库的方法》JSON,全程是JavaScriptObjectNotation,是一种轻量级的数据交换格式,本文给大家介绍springboot项目中使用JOSN... 目录一、jsON解析简介二、Spring Boot项目中使用JSON解析1、pom.XML文件引入依

使用vscode搭建pywebview集成vue项目实践

《使用vscode搭建pywebview集成vue项目实践》:本文主要介绍使用vscode搭建pywebview集成vue项目实践,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地... 目录环境准备项目源码下载项目说明调试与生成可执行文件核心代码说明总结本节我们使用pythonpywebv

Maven项目中集成数据库文档生成工具的操作步骤

《Maven项目中集成数据库文档生成工具的操作步骤》在Maven项目中,可以通过集成数据库文档生成工具来自动生成数据库文档,本文为大家整理了使用screw-maven-plugin(推荐)的完... 目录1. 添加插件配置到 pom.XML2. 配置数据库信息3. 执行生成命令4. 高级配置选项5. 注意事

eclipse如何运行springboot项目

《eclipse如何运行springboot项目》:本文主要介绍eclipse如何运行springboot项目问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目js录当在eclipse启动spring boot项目时出现问题解决办法1.通过cmd命令行2.在ecl

SpringBoot项目Web拦截器使用的多种方式

《SpringBoot项目Web拦截器使用的多种方式》在SpringBoot应用中,Web拦截器(Interceptor)是一种用于在请求处理的不同阶段执行自定义逻辑的机制,下面给大家介绍Sprin... 目录一、实现 HandlerInterceptor 接口1、创建HandlerInterceptor实

Maven项目打包时添加本地Jar包的操作步骤

《Maven项目打包时添加本地Jar包的操作步骤》在Maven项目开发中,我们经常会遇到需要引入本地Jar包的场景,比如使用未发布到中央仓库的第三方库或者处理版本冲突的依赖项,本文将详细介绍如何通过M... 目录一、适用场景说明​二、核心操作命令​1. 命令格式解析​2. 实战案例演示​三、项目配置步骤​1