赞
踩
本节:后端传过来的内容,是一长串链接用下划线___分隔,前端要转换成对应的字段,点击之后可以到对应的链接地址。
- div的内容
- <div id="intro">Stock: <span id="stock1"></span></div>
- <div id="intro" >Tags:
- <div id="tags" v-for="(i,index) in tags" :key="'i-' + index">
- <span id="tags" style="margin-right:10px;">
- <dl v-html="i">
- {{i}}
- </dl>
- </span>
- </div>
- </div>
-
- 定义数组: tags:[],
-
-
- 接口的内容
- getImg_products() {
- var that = this;
- var params={
- idtype:getParameter("idtype"),
- typeid:getParameter("typeid"),
- };
-
- $.post('../product/list.action', params, function(res){
- console.log(res);
- that.products = res.products;
- console.log(that.products);
- $('#spec1').text(that.products[0].zdy2);
- $('#stock1').text(that.products[0].stock);
- that.tags = that.products[0].zdy10.split("___");// 这里转成数组了 可以用这个数组去赋值
-
- $('#stock1').text(that.products[0].stock);
- $('#u1600_img').on('click',function(){
- $('#u1609_img').attr("src","../"+that.products[0].photo1);
-
- });
-
-
-
- });
- },

赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。