Vue数据发送

来源:互联网 发布:php打印直角三角形 编辑:程序博客网 时间:2024/06/06 01:14
npm install yarn -gyarn add vuex --dev----------dev-server.js  console.log()操作后  在internal里面可以显示

三元表达式 变量绑定

:class="spacial_sale ? 'ctn_sale' : 'ctn_others'":src="[spacial_sale ? item.image : item.imgurl]" {{spacial_sale ? item.promotionlist[0].name : item.discount}}

页面跳转需要刷新一下

 <span v-for="item in title_ytjj_ctn_center">   <router-link       :to="{ path: 'index_ctn', query: {    searchCondition: split_value(item.jumpurl),         title: split_title(item.jumpurl)}}">      <img :src="item.imgurl" alt="" @click="fresh">    </router-link>  </span>  --------------------------华丽分割线-------------------------- methods:{      fresh(){        this.$router.go(0);      }    }

接受参数发送请求数据

mounted () {      this.$http.get(this.urlObj.index_ctn_special, {        params: {          listid: this.$route.query.listid        }      }).then(data => {        console.log(data);        this.msg = data.body.data.product_list        this.classArr = data.body.data.filter_group      })    },

后台返回数据

//页面 本周推荐一下内容的下一行至末尾   特殊部分  大横条apiRoutes.get("/index_ctn_special", function (req, res) {  let listid = req.query.listid  requ('https://m.yintai.com/Services/Proxy.ashx?r=201707240802&methodName=product.customtopiclist_3.0.0&method=product.customtopiclist&ver=3.0.0&client_v=3.1.5&apptype=10&data=%7B%22order_type%22%3A%220%22%2C%22page_index%22%3A1%2C%22displaycount%22%3A10%2C%22keyword%22%3A%22'+ listid +'%22%7D', function (err, data) {    res.json(JSON.parse(data.body))  })})
原创粉丝点击