cncml手绘网
标题:
实现 tp循环输出el
[打印本页]
作者:
admin
时间:
2018-8-6 20:07
标题:
实现 tp循环输出el
php-html
: }/ h9 E/ G% w. I% Q5 j! i
<div id = "computed_props{$v['id']}">
* C1 n( ~2 S* I7 i; n
<input style="width:50px;" type = "text" v-model = "kilometers" placeholder="20" >
# J C6 r# ]! S# J9 V* P
<a class="btn btn-xs btn-info" style="display:inline-block;" v-bind:href="url" >修改比例为{{meters}}</a>
; ^; @& M! X( I* n
</div>
复制代码
vue.js
% ?/ Y8 v) n7 P5 ^/ ^1 h# L; V
<script type = "text/javascript">
4 h! |* o& G- Y
( z+ K6 D) y$ C
var ids = <?=$v['id']?>;
9 ]$ C' [$ @1 Y% _
var shop_xjcbl = <?=$v['shop_xjcbl']?>;
3 c( X) }2 B* v' C& C: A( I2 C
: D: p% c# I) F
var vm = new Vue({
' G6 Z3 p! |2 \
el: '#computed_props'+<?=$v['id']?>,
; `8 W9 t% d& m1 B4 r# g
data: {
( |% H# T7 t7 X9 ?# v1 K1 A3 k
kilometers : <?=$v['shop_xjcbl']?>,
+ F5 n1 ^, y3 m7 M' P) m% O
meters: <?=$v['shop_xjcbl']?>,
# s$ s3 h; {! }( M h0 O4 G
id:<?=$v['id']?>,
% s" K* m! P h6 Y( r% {
url:'/nc.php?s=/goods/xiugaibili/id/'+ids+'/shop_xjcbl/'+shop_xjcbl+'.html',
& M/ q$ f& O/ N4 Q
},
* a! a3 a& Q" f) s- w! w0 {
methods: {
' T" {0 t. ~# ?6 U
/ n; \/ p) {4 e O
},
9 S1 B# Z, o3 [
computed :{
4 R2 \0 y# K: [4 w/ m' O0 m& H! O: {
},
' g3 U+ X) n9 q8 x) ?% L
watch : {
: p5 H) c: ~8 q2 b
kilometers:function(val) {
1 {* l' k2 I3 p2 V
this.kilometers = val;
: r$ }" R6 z2 A5 d) W8 M
this.meters = val ;
- M# B2 ]! g% |8 s
this.url = '/nc.php?s=/goods/xiugaibili/id/'+this.id+'/shop_xjcbl/'+this.kilometers+'.html';
6 s6 U$ D/ U3 h" S
},
! t' d- L. A$ ~
meters : function (val) {
$ p$ E5 w) w1 i. @0 @4 {
this.kilometers = val;
; k' ]+ {( \ ^7 A: P. Y1 C; n, H( R
this.meters = val;
$ }1 b+ C: H, v- p" a6 T* g$ n
}
p$ b5 a4 W; G
}
: z o( f0 e% q1 t
});
+ Q% y! m: }$ h; Q' n" r
" M, p9 A8 u9 U+ [6 |
7 x* L: L+ ^& V- B
</script>
复制代码
) ~1 R/ {8 o" @# w4 M4 O0 Q
+ Q1 ^# T6 z) u0 x1 J
欢迎光临 cncml手绘网 (http://bbs.cncml.com/)
Powered by Discuz! X3.2