当前位置: 首页 > news >正文

张掖市网站建设_网站建设公司_测试上线_seo优化

电脑网页打不开建设银行网站,手机建站图片,网站开发用什么写得比较好,深圳网站建设价格是多少用Vue实现购物车。 程序详解#xff1a; 页面要显示商品的基本信息#xff08;编号#xff0c;名称#xff0c;单价#xff0c;购买数量#xff0c;总价等#xff09; 1.增加和减少商品数量 2.商品金额会随数量变化 3.会自动计算总金额 4.对某一类商品进行移除操作 5.还…用Vue实现购物车。 程序详解 页面要显示商品的基本信息编号名称单价购买数量总价等 1.增加和减少商品数量 2.商品金额会随数量变化 3.会自动计算总金额 4.对某一类商品进行移除操作 5.还有清空购物车 效果演示 原始样式 增加iphone5s和macbook的数量都为5则总价随之变化 移除iphone5s这一类商品 点击清空购物车按钮 看了上面的演示有没有心动的感觉呢 代码演示 导入三个文件 headmeta charsetutf-8link relstylesheet hrefhttps://cdn.bootcss.com/bootstrap/3.0.2/css/bootstrap.min.css relexternal nofollow /script srchttps://unpkg.com/tween.js16.3.4/scriptscript srchttps://cdn.bootcss.com/vue/2.2.3/vue.min.js/script/headbody内容 bodydiv idall classcontainertable classtabletheadtrth产品编号/thth产品名字/thth购买数量/thth产品单价/thth产品总价/thth操作/th/tr/theadtbodytr v-for(item , index) in messagetd clickjia(index){{item.id}}/tdtd{{item.name}}/tdtdbutton typebutton classbtn tn-primary clicksubtract(index)-/buttoninput typetext v-modelitem.quantitybutton typebutton classbtn tn-primary clickadd(index)/button/tdtd{{item.price | filtermoney}}/tdtd{{item.price*item.quantity | filtermoney}}/tdtdbutton typebutton classbtn btn-danger clickremove(index)移除/button/td/trtrtd总购买价/tdtd{{animatenum | filtermoney}}/tdtd总购买数量/tdtd/tdtd colspan2button typebutton classbtn btn-danger clickempty()清空购物车/button/td/tr/tbody/tablep v-ifmessage.length0您的购物车为空/p/div/bodyVue代码 scriptvar vm new Vue({el: #all,data: {totalPrice: 0,animatenum: 0,message: [{id: 1003,name: iphone5s,quantity: 1,price: 3000}, {id: 1009,name: iphone11,quantity: 3,price: 8000}, {id: 1024,name: macbook,quantity: 1,price: 15000}, {id: 2019,name: ipad pro,quantity: 2,price: 7000}]},watch: {Computer: function(newValue, oldValue) {this.tween(newValue, oldValue);}},computed: {Computer: function() {var vm this;vm.totalPrice 0;this.message.forEach(function(mess) {vm.totalPrice parseInt(mess.price * mess.quantity);})return this.totalPrice;}},filters: {filtermoney: function(value) {return value;}},mounted: function() {this.tween(49000, 0);},methods: {toComput: function() {var vm this;vm.message.forEach(function(mess) {vm.totalPrice parseInt(mess.price * mess.quantity);})return vm.totalPrice;},add: function(index) {var vm this;vm.message[index].quantity;},subtract: function(index) {var vm this;vm.message[index].quantity--;if (vm.message[index].quantity 0) {if (confirm(你确定移除该商品)) {vm.message.splice(index, 1)}}},remove: function(index) {var vm this;if (confirm(你确定移除该商品)) {vm.message.splice(index, 1)}},empty: function() {var vm this;vm.message.splice(0, vm.message.length);},jia: function(index) {var vm this;vm.arr[index].one;},tween: function(newValue, oldValue) {var vm this;var twen new TWEEN.Tween({animatenum: oldValue});function animate() {requestAnimationFrame(animate);TWEEN.update();};twen.to({animatenum: newValue}, 750);twen.onUpdate(function() {vm.animatenum this.animatenum.toFixed();})twen.start();animate();}}});/script如果看上面分步代码有点疑惑的话看下面总体代码 总体代码展示 !DOCTYPE html htmlheadmeta charsetutf-8link relstylesheet hrefhttps://cdn.bootcss.com/bootstrap/3.0.2/css/bootstrap.min.css relexternal nofollow /script srchttps://unpkg.com/tween.js16.3.4/scriptscript srchttps://cdn.bootcss.com/vue/2.2.3/vue.min.js/script/headbodydiv idall classcontainertable classtabletheadtrth产品编号/thth产品名字/thth购买数量/thth产品单价/thth产品总价/thth操作/th/tr/theadtbodytr v-for(item , index) in messagetd clickjia(index){{item.id}}/tdtd{{item.name}}/tdtdbutton typebutton classbtn tn-primary clicksubtract(index)-/buttoninput typetext v-modelitem.quantitybutton typebutton classbtn tn-primary clickadd(index)/button/tdtd{{item.price | filtermoney}}/tdtd{{item.price*item.quantity | filtermoney}}/tdtdbutton typebutton classbtn btn-danger clickremove(index)移除/button/td/trtrtd总购买价/tdtd{{animatenum | filtermoney}}/tdtd总购买数量/tdtd/tdtd colspan2button typebutton classbtn btn-danger clickempty()清空购物车/button/td/tr/tbody/tablep v-ifmessage.length0您的购物车为空/p/div/bodyscriptvar vm new Vue({el: #all,data: {totalPrice: 0,animatenum: 0,message: [{id: 1003,name: iphone5s,quantity: 1,price: 3000}, {id: 1009,name: iphone11,quantity: 3,price: 8000}, {id: 1024,name: macbook,quantity: 1,price: 15000}, {id: 2019,name: ipad pro,quantity: 2,price: 7000}]},watch: {Computer: function(newValue, oldValue) {this.tween(newValue, oldValue);}},computed: {Computer: function() {var vm this;vm.totalPrice 0;this.message.forEach(function(mess) {vm.totalPrice parseInt(mess.price * mess.quantity);})return this.totalPrice;}},filters: {filtermoney: function(value) {return value;}},mounted: function() {this.tween(49000, 0);},methods: {toComput: function() {var vm this;vm.message.forEach(function(mess) {vm.totalPrice parseInt(mess.price * mess.quantity);})return vm.totalPrice;},add: function(index) {var vm this;vm.message[index].quantity;},subtract: function(index) {var vm this;vm.message[index].quantity--;if (vm.message[index].quantity 0) {if (confirm(你确定移除该商品)) {vm.message.splice(index, 1)}}},remove: function(index) {var vm this;if (confirm(你确定移除该商品)) {vm.message.splice(index, 1)}},empty: function() {var vm this;vm.message.splice(0, vm.message.length);},jia: function(index) {var vm this;vm.arr[index].one;},tween: function(newValue, oldValue) {var vm this;var twen new TWEEN.Tween({animatenum: oldValue});function animate() {requestAnimationFrame(animate);TWEEN.update();};twen.to({animatenum: newValue}, 750);twen.onUpdate(function() {vm.animatenum this.animatenum.toFixed();})twen.start();animate();}}});/script /html 扫一扫关注我的公众号获取更多资讯呦
http://www.ihoyoo.com/news/101642.html

相关文章:

  • php做网站软件郑州网络开发公司有哪些
  • 网站引导页是什么问题网站ip如何做跳转
  • 青岛网站关键词推广有个可以做图片的网站
  • 光谷做网站推广哪家好自动的小企业网站建设
  • 福州做网站建设成都有哪些网站建设的公司
  • 网站做第三方支付公司建设网站价格
  • 赤峰建设业协会的官方网站wordpress 媒体分类
  • WordPress标签伪搜索引擎优化与推广技术
  • 网站描述修改专业合肥网站建设
  • 游戏推广网站如何做的做网站流量怎么赚钱吗
  • 高端品牌裙子怎么把做的网站优化到百度
  • 男的怎么做直播网站字体设计转换器
  • 搜狗搜索引擎入口手机网站免费优化
  • 怎么制作一个免费的网站模板7下载wordpress
  • 站外推广内容策划企业网站价格多少钱
  • 怎样让网站优化的方式公司网站如何做百度收录
  • 江苏关键词推广seo做seo有什么好处
  • 学校网站作用男女做爰视频网站
  • 天猫网站建设论文辽宁省建设工程信息网锁丢失
  • 银川建设公司网站电脑做网站教学
  • 东丽开发区做网站公司下面软件是网页制作平台的是( )
  • 如何建立自己的网站去推广义乌 网站建设推广营销
  • 公司网站建设合规吗网站单页seo
  • 哈尔滨网站设计福州seo
  • 无锡制作网站价格周至县做网站
  • 网站评论列表模板东莞网页网站制作
  • 上海网站推广排名公司小程序打包成app
  • 加强局网站建设手机网站logo
  • 网站建设 找客户网站建设发货流程图
  • 美橙建站五站合一软件公司起名字免费软件