图书项目要点

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

相关文章

vite搭建vue3项目的搭建步骤

《vite搭建vue3项目的搭建步骤》本文主要介绍了vite搭建vue3项目的搭建步骤,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学... 目录1.确保Nodejs环境2.使用vite-cli工具3.进入项目安装依赖1.确保Nodejs环境

idea+spring boot创建项目的搭建全过程

《idea+springboot创建项目的搭建全过程》SpringBoot是Spring社区发布的一个开源项目,旨在帮助开发者快速并且更简单的构建项目,:本文主要介绍idea+springb... 目录一.idea四种搭建方式1.Javaidea命名规范2JavaWebTomcat的安装一.明确tomcat

pycharm跑python项目易出错的问题总结

《pycharm跑python项目易出错的问题总结》:本文主要介绍pycharm跑python项目易出错问题的相关资料,当你在PyCharm中运行Python程序时遇到报错,可以按照以下步骤进行排... 1. 一定不要在pycharm终端里面创建环境安装别人的项目子模块等,有可能出现的问题就是你不报错都安装

uni-app小程序项目中实现前端图片压缩实现方式(附详细代码)

《uni-app小程序项目中实现前端图片压缩实现方式(附详细代码)》在uni-app开发中,文件上传和图片处理是很常见的需求,但也经常会遇到各种问题,下面:本文主要介绍uni-app小程序项目中实... 目录方式一:使用<canvas>实现图片压缩(推荐,兼容性好)示例代码(小程序平台):方式二:使用uni

MyCat分库分表的项目实践

《MyCat分库分表的项目实践》分库分表解决大数据量和高并发性能瓶颈,MyCat作为中间件支持分片、读写分离与事务处理,本文就来介绍一下MyCat分库分表的实践,感兴趣的可以了解一下... 目录一、为什么要分库分表?二、分库分表的常见方案三、MyCat简介四、MyCat分库分表深度解析1. 架构原理2. 分

linux查找java项目日志查找报错信息方式

《linux查找java项目日志查找报错信息方式》日志查找定位步骤:进入项目,用tail-f实时跟踪日志,tail-n1000查看末尾1000行,grep搜索关键词或时间,vim内精准查找并高亮定位,... 目录日志查找定位在当前文件里找到报错消息总结日志查找定位1.cd 进入项目2.正常日志 和错误日

在.NET项目中嵌入Python代码的实践指南

《在.NET项目中嵌入Python代码的实践指南》在现代开发中,.NET与Python的协作需求日益增长,从机器学习模型集成到科学计算,从脚本自动化到数据分析,然而,传统的解决方案(如HTTPAPI或... 目录一、CSnakes vs python.NET:为何选择 CSnakes?二、环境准备:从 Py

基于 Cursor 开发 Spring Boot 项目详细攻略

《基于Cursor开发SpringBoot项目详细攻略》Cursor是集成GPT4、Claude3.5等LLM的VSCode类AI编程工具,支持SpringBoot项目开发全流程,涵盖环境配... 目录cursor是什么?基于 Cursor 开发 Spring Boot 项目完整指南1. 环境准备2. 创建

Three.js构建一个 3D 商品展示空间完整实战项目

《Three.js构建一个3D商品展示空间完整实战项目》Three.js是一个强大的JavaScript库,专用于在Web浏览器中创建3D图形,:本文主要介绍Three.js构建一个3D商品展... 目录引言项目核心技术1. 项目架构与资源组织2. 多模型切换、交互热点绑定3. 移动端适配与帧率优化4. 可

sky-take-out项目中Redis的使用示例详解

《sky-take-out项目中Redis的使用示例详解》SpringCache是Spring的缓存抽象层,通过注解简化缓存管理,支持Redis等提供者,适用于方法结果缓存、更新和删除操作,但无法实现... 目录Spring Cache主要特性核心注解1.@Cacheable2.@CachePut3.@Ca