博客
关于我
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/

你可能感兴趣的文章
node.js安装方法
查看>>
Node.js官网无法正常访问时安装NodeJS的方法
查看>>
node.js模块、包
查看>>
node.js模拟qq漂流瓶
查看>>
node.js的express框架用法(一)
查看>>
Node.js的交互式解释器(REPL)
查看>>
Node.js的循环与异步问题
查看>>
Node.js高级编程:用Javascript构建可伸缩应用(1)1.1 介绍和安装-安装Node
查看>>
nodejs + socket.io 同时使用http 和 https
查看>>
NodeJS @kubernetes/client-node连接到kubernetes集群的方法
查看>>
NodeJS API简介
查看>>
Nodejs express 获取url参数,post参数的三种方式
查看>>
nodejs http小爬虫
查看>>
nodejs libararies
查看>>
vue3+element-plus 项目中 el-switch 刷新后自动触发change?坑就藏在这里!
查看>>
nodejs npm常用命令
查看>>
nodejs npm常用命令
查看>>
Nodejs process.nextTick() 使用详解
查看>>
NodeJS yarn 或 npm如何切换淘宝或国外镜像源
查看>>
nodejs 中间件理解
查看>>