博客
关于我
vue小项目实现后台管理
阅读量:526 次
发布时间:2019-03-08

本文共 1706 字,大约阅读时间需要 5 分钟。

使用vue实现图书后台管理

使用工具:HBuild X,真的是一款超实用的软件

附上下载地址:
新建项目
在这里插入图片描述
这就是为什么用这款软件的好处了,脚手架之类的环境以及其他插件,里面都设置好了

进入主题

css文件:

table{   	border: 1px solid #e9e9e9;	width: 500px;	border-collapse: collapse;	border-spacing: 0;}th,td{   	padding: 8px,16px;	border: 1px solid #e9e9e9;	text-align: align;}th{   	background-color: #f7f7f7;	color: #0000ff;	font-weight: 600;}

.js文件

const app = new Vue({   	el:'#app',	data:{   		books:[			{   			id:1,			name:'《算法导论》',			date:'2020-4',			price:85.00,			count:1			},			{   			id:2,			name:'《Linux编程技术》',			date:'2018-2',			price:59.00,			count:1			},			{   			id:3,			name:'《深入理解java虚拟机》',			date:'2019-9',			price:95.00,			count:1			},			{   			id:4,			name:'《编程大全》',			date:'2015-9',			price:89.00,			count:1			}		]	},	methods:{   		increment(index){   			this.books[index].count++;		},		discrement(index){   			this.books[index].count--;		},		removeBooks(index){   			/* 因为下标值比id刚好小1 */			this.books.splice(index,1);		}	},	computed:{   		totalPrice(){   			let sum = 0;			for (var i = 0; i < this.books.length; i++) {   				sum = sum + this.books[i].count * this.books[i].price;			}			return sum;		}	}})

最终的html文件

			
书籍名称 出版日期 价格 购买数量 操作
{ { i.id}} { { i.name}} { { i.date}} { { i.price}} { { i.count}}

总价格为:{ { totalPrice}}

订单为空

最终的页面

在这里插入图片描述
全部删除后的页面
在这里插入图片描述

把这个写完,这个vue的基础语法就能过关了

另外:赠人玫瑰,手留余香

该小管理系统的出处来自:

转载地址:http://fahnz.baihongyu.com/

你可能感兴趣的文章
NOAA(美国海洋和大气管理局)气象数据获取与POI点数据获取
查看>>
NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
查看>>
node
查看>>
node exporter完整版
查看>>
node HelloWorld入门篇
查看>>
Node JS: < 一> 初识Node JS
查看>>
Node JS: < 二> Node JS例子解析
查看>>
Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime(93)解决
查看>>
Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime(72)
查看>>
Node 裁切图片的方法
查看>>
node+express+mysql 实现登陆注册
查看>>
Node+Express连接mysql实现增删改查
查看>>
node, nvm, npm,pnpm,以前简单的前端环境为什么越来越复杂
查看>>
Node-RED中Button按钮组件和TextInput文字输入组件的使用
查看>>
vue3+Ts 项目打包时报错 ‘reactive‘is declared but its value is never read.及解决方法
查看>>
Node-RED中Switch开关和Dropdown选择组件的使用
查看>>
Node-RED中使用exec节点实现调用外部exe程序
查看>>
Node-RED中使用function函式节点实现数值计算(相加计算)
查看>>
Node-RED中使用html节点爬取HTML网页资料之爬取Node-RED的最新版本
查看>>
Node-RED中使用JSON数据建立web网站
查看>>