(28)打鸡儿教你Vue.js

作者: 魔王哪吒 | 来源:发表于2019-07-05 14:24 被阅读11次

单件商品金额计算和单选全选功能

new Vue({
 el: '#app',
 data: {
  totalMoney: 0,
  productList: []
 },
 filters: {
  formatMoney: function (value) {
   return "¥ " + value.toFixed(2);
  },
 },
 mounted: function() {
  this.$nextTick(function(){
   this.cartView();
  });
 },
 methods: {
  cartView: function() {
   let _this = this;
   this.$http.get("data/cartData.json", {"id":123}).then(res=>{
   this.productList = res.body.result.list;
   this.totalMoney = res.body.result.totalMoney;
  });
  }
 }
});
Vue.filter("money", function(value,type) {
 return "¥ "+value.toFixed(2) + type;
})
changeMoney: function(product, way){
if(way>0){
 product.productQuentity++;
 }else{
 product.productQuentity--;
 if(product.productQuentity<1){
  product.productQuentity = 1;
 }
 }
}
selectedProduct: function (item) {
 if(typeof item.checked == 'undefined'){
  Vue.set(item, "checked", true);
 }else {
  item.checked = !item.checked;
 }
}
image.png

地址列表

image.png image.png image.png image.png
new Vue({
 el: '.container',
 data: {
  addressList: []
 },
 mounted: function() {
  this.$nextTick(function(){
  });
 },
 methods: {
  getAddressList: function() {
   var _this = this;
   this.$http.get("data/address.json").then(function (response){
   var res = response.data;
   if(res.status == "0"){
     _this.addressList = res.result;
   }
  });
 }
 }
});
image.png image.png
v-model v-text v-show v-if v-bind v-for v-on

axios


请点赞!因为你的鼓励是我写作的最大动力!

官方微信公众号

吹逼交流群:711613774

吹逼交流群

相关文章

  • (28)打鸡儿教你Vue.js

    单件商品金额计算和单选全选功能 地址列表 axios 请点赞!因为你的鼓励是我写作的最大动力! 吹逼交流群:711...

  • (2)打鸡儿教你Vue.js

    Vue双向绑定 语法:v-bind:title="msg"简写::title="msg" key属性 -class...

  • (3)打鸡儿教你Vue.js

    vue.js是一套构建用户界面的渐进式框架vue关注视图层,采用自底向上增量开发的设计 vue.js安装下载 vu...

  • (20)打鸡儿教你Vue.js

    vue-cli 快速创建工程,工程化项目目录 https://www.bootcdn.cn/ https://ww...

  • (21)打鸡儿教你Vue.js

    组件化思想: 组件化实现功能模块的复用 高执行效率 开发单页面复杂应用 组件状态管理(vuex) 多组件的混合使用...

  • (23)打鸡儿教你Vue.js

    实例: 模板语法vue-router,vuex以及调式方法介绍打包部署: Webpack 目前无论在求职还是工作中...

  • (22)打鸡儿教你Vue.js

    vue.js 单页面,多页面 Vue cli工具复杂单页面应用Vue cli工具 交互设计,逻辑设计,接口设计 代...

  • (27)打鸡儿教你Vue.js

    v-for 数组参数的顺序 当含有index时,以前传递的参数顺序是:(index, value)。现在(valu...

  • (19)打鸡儿教你Vue.js

    了解vue2.x的核心技术 建立前端组件化的思想 常用的vue语法 vue-router,vuex,vue-cli...

  • (26)打鸡儿教你Vue.js

    weex框架的使用 1、weex开发入门2、weex开发环境搭建3、掌握部分weex组件模块4、了解一些vue基本...

网友评论

    本文标题:(28)打鸡儿教你Vue.js

    本文链接:https://www.haomeiwen.com/subject/tvvshctx.html