cncml手绘网
标题:
实现 tp循环输出el
[打印本页]
作者:
admin
时间:
2018-8-6 20:07
标题:
实现 tp循环输出el
php-html
4 a+ k) J- G% z3 T7 D! Y
<div id = "computed_props{$v['id']}">
4 h: f6 v9 F& H) U2 a! ]! i' h1 W6 |
<input style="width:50px;" type = "text" v-model = "kilometers" placeholder="20" >
! F' [ D" ^2 j0 H
<a class="btn btn-xs btn-info" style="display:inline-block;" v-bind:href="url" >修改比例为{{meters}}</a>
]- S" M( b: [4 \% D0 P( I$ ^
</div>
复制代码
vue.js
) Y: R# c& C/ s6 T
<script type = "text/javascript">
9 h* V* o+ k$ F- e# I
$ |. c* o( X! D* Z& h
var ids = <?=$v['id']?>;
4 g# X3 ]( q+ T6 s+ B
var shop_xjcbl = <?=$v['shop_xjcbl']?>;
8 O5 U d: ~6 J" j
6 l' p% t: S+ q
var vm = new Vue({
8 h& z0 e3 K# H
el: '#computed_props'+<?=$v['id']?>,
: v6 U: s9 C: r, I6 l7 I- I
data: {
: q; g) j' f) l4 f% r5 N1 ~4 c+ V2 k
kilometers : <?=$v['shop_xjcbl']?>,
' r) b8 E8 \) c
meters: <?=$v['shop_xjcbl']?>,
7 }7 s' f+ L# p* P y/ h; [
id:<?=$v['id']?>,
6 p0 x+ ]/ |6 x
url:'/nc.php?s=/goods/xiugaibili/id/'+ids+'/shop_xjcbl/'+shop_xjcbl+'.html',
( J1 N c7 C* M( r/ {. C' X
},
! z) g3 \0 w! ^# X2 a3 D% j0 k
methods: {
5 f% q) Z! U V
I* n& d5 |- b9 I& d; J
},
z; x/ r$ u8 Z5 I1 E: Z
computed :{
. {6 g6 i3 [6 n7 O: a0 |& D
},
2 d' K" c. C- `. x/ j d
watch : {
& e% o5 N t9 W1 C/ Q
kilometers:function(val) {
* x! t& z2 B" r" K5 r5 T- I- |
this.kilometers = val;
! R* ^, r* K/ [% f
this.meters = val ;
& s3 X1 A9 o# v p' d
this.url = '/nc.php?s=/goods/xiugaibili/id/'+this.id+'/shop_xjcbl/'+this.kilometers+'.html';
2 ]# V( l K; |4 I% E
},
, n# x4 f9 E$ ^( B8 A$ h5 n% J2 q, k
meters : function (val) {
) y! W q) H* d; V6 a, w E
this.kilometers = val;
/ q5 B3 @+ r: g! t9 M
this.meters = val;
6 W F& p" A% @3 v
}
! }) x$ G& |' }4 i
}
3 s, m, ^" S0 D m$ V
});
& a# K( ?* o! b' A
5 c1 k" S$ |* @( e; y, H
: x3 a' P* S. c, S
</script>
复制代码
3 h3 B0 d. F+ g1 T- [0 N. r
?" U. [* j6 z. Z
欢迎光临 cncml手绘网 (http://cncml.com/)
Powered by Discuz! X3.2