管理员
论坛积分
分
威望 点
贡献值 个
金币 枚
|
php-html5 R/ t A0 R- e+ e" x& B( y/ ^) o
- <div id = "computed_props{$v['id']}">
4 g( y" [) h& ~" R, f8 R7 k- I8 S2 R - <input style="width:50px;" type = "text" v-model = "kilometers" placeholder="20" >/ h7 Z( S% F: v- \0 y% q( x% k, p
- <a class="btn btn-xs btn-info" style="display:inline-block;" v-bind:href="url" >修改比例为{{meters}}</a>; `8 |3 O( f B) x# Q% f6 e0 X
- </div>
复制代码 vue.js
0 J- ]& d) t( Z# T; `- <script type = "text/javascript">. _6 s0 }1 T: m2 E
- 8 m* J1 F$ z! |$ k, q" e$ a
- var ids = <?=$v['id']?>;
- [- |0 q* L/ t. F$ v+ x - var shop_xjcbl = <?=$v['shop_xjcbl']?>;, w4 h1 p1 ]3 D& s" n; a& U6 C
- - a: X+ l: U1 L7 ~, l
- var vm = new Vue({' Y- e# ~8 K* K, [9 E$ P
- el: '#computed_props'+<?=$v['id']?>,
. d! F9 ?; [9 K6 v- k% C, ` - data: {! E+ g6 r* u1 M
- kilometers : <?=$v['shop_xjcbl']?>,
# Z6 A4 x6 z1 [! h - meters: <?=$v['shop_xjcbl']?>,( D/ t; p7 f1 V& m) G& z( [
- id:<?=$v['id']?>,: K: A1 C& h) T( m" ~
- url:'/nc.php?s=/goods/xiugaibili/id/'+ids+'/shop_xjcbl/'+shop_xjcbl+'.html',
7 f3 q9 W4 Z7 ^2 m: s - },3 u/ D/ S& z: @8 R6 o7 i( s. m
- methods: {9 Q- y% K% z# I% w$ R- j
-
, g' J; F8 f& ]2 {+ t( L: \$ c - },
+ A8 d3 T" t b8 _: a# | - computed :{
7 b7 W) x4 E0 e- W7 J - },9 `- p0 z2 W' h
- watch : {# N- b& ~6 W* |1 L% a( ]( ]
- kilometers:function(val) {2 s1 f! m0 `; ^' k
- this.kilometers = val;* ?2 O$ Y. l4 x8 B5 {( C
- this.meters = val ;
; v! u$ U2 K2 ~ - this.url = '/nc.php?s=/goods/xiugaibili/id/'+this.id+'/shop_xjcbl/'+this.kilometers+'.html';& a4 f4 B" L0 E S; @
- },
3 n* Y6 I& u5 ^4 w) z - meters : function (val) {" s, }& B* k0 ]/ V7 M; }/ ]1 M
- this.kilometers = val;
G) P" @4 [+ m4 A1 v. l0 q - this.meters = val;
! z p; `4 f; m0 o8 J' H. | - }
9 g# U/ ^# s9 F( t4 M! ~0 C - }
- ^9 }8 l, @/ Q - });
3 W9 f5 @: I0 ?3 V; _/ ~, i# Q
1 G* i' j$ s: t* |+ q- ; S) m. D$ \& C; ]6 o
- </script>
复制代码
$ u! p8 i4 ?& P1 K
# _) m0 A$ ]3 g0 R6 q( f/ d& Q7 o |
|