Commit 145c620a3a3bb0a67a068708ecaf76cc5fb14f05

Authored by liuqimichale
1 parent 8da434bf

传值

src/components/home.vue
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <div class="wrap"> 2 <div class="wrap">
3 <InOut v-if="inOutVal==='1'" :toflag = "0"/> 3 <InOut v-if="inOutVal==='1'" :toflag = "0"/>
4 <Pay v-else-if="inOutVal==='2'&&_getPayFlag" :title="title" :money="money"/> 4 <Pay v-else-if="inOutVal==='2'&&_getPayFlag" :title="title" :money="money"/>
5 - <InOut v-else :toflag = "1"/> 5 + <InOut v-else :toflag = "1" @commitpass="transmit"/>
6 <Loading v-show="_getshowflag"/> 6 <Loading v-show="_getshowflag"/>
7 </div> 7 </div>
8 </template> 8 </template>
@@ -40,10 +40,10 @@ export default { @@ -40,10 +40,10 @@ export default {
40 // console.log(response) 40 // console.log(response)
41 // }) 41 // })
42 // }, 42 // },
43 - this.handlePayFlag() 43 + // this.handlePayFlag()
44 console.log(this._getPayFlag) 44 console.log(this._getPayFlag)
45 - this.title = '手机: 13911137584'  
46 - this.money = '¥100.00' 45 + // this.title = '手机: 13911137584'
  46 + // this.money = '¥100.00'
47 }, 2000) 47 }, 2000)
48 }, 48 },
49 methods: { 49 methods: {
@@ -51,7 +51,12 @@ export default { @@ -51,7 +51,12 @@ export default {
51 'handleHide', 51 'handleHide',
52 'handleShow', 52 'handleShow',
53 'handlePayFlag' 53 'handlePayFlag'
54 - ]) 54 + ]),
  55 + transmit(data) {
  56 + console.log(data)
  57 + this.title = data.title
  58 + this.money = data.money
  59 + }
55 } 60 }
56 } 61 }
57 </script> 62 </script>
src/components/inout.vue
1 <template> 1 <template>
2 <div class="inout-wrap"> 2 <div class="inout-wrap">
3 <div class="title">无牌车{{ toflag =='0' ? '入场' : '出场' }}结算</div> 3 <div class="title">无牌车{{ toflag =='0' ? '入场' : '出场' }}结算</div>
4 - <div :class="tipsClass" class="tips-text" >{{ tipsText }}</div> 4 + <div :class="tipsClass" class="tips-text">{{ tipsText }}</div>
5 <div class="inout-fix"></div> 5 <div class="inout-fix"></div>
6 - <input v-show="inputType" ref="phoneVal" type="text" placeholder="请输入手机号" maxlength="11" onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');" >  
7 - <input v-show="!inputType" ref="carVal" type="text" placeholder="请输入车牌号" maxlength="8"> 6 + <input
  7 + v-show="inputType"
  8 + ref="phoneVal"
  9 + type="text"
  10 + placeholder="请输入手机号"
  11 + maxlength="11"
  12 + onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');">
  13 + <input
  14 + v-show="!inputType"
  15 + ref="carVal"
  16 + type="text"
  17 + placeholder="请输入车牌号"
  18 + maxlength="8">
8 <div class="toggle-btn" @click="togglebtn"> 19 <div class="toggle-btn" @click="togglebtn">
9 <img src="../assets/toggle-btn.png"> 20 <img src="../assets/toggle-btn.png">
10 {{ toggleText }} 21 {{ toggleText }}
@@ -64,6 +75,11 @@ export default { @@ -64,6 +75,11 @@ export default {
64 this.tipsClass = 'successClass' 75 this.tipsClass = 'successClass'
65 if (this.toflag === 1) { 76 if (this.toflag === 1) {
66 this.handlePayFlag() 77 this.handlePayFlag()
  78 + const passdata = {
  79 + title: '手机号123',
  80 + money: '¥1000.00'
  81 + }
  82 + this.$emit('commitpass', passdata)
67 } 83 }
68 }, 2000) 84 }, 2000)
69 } else { 85 } else {
@@ -158,7 +174,7 @@ export default { @@ -158,7 +174,7 @@ export default {
158 .errorClass { 174 .errorClass {
159 color: #f00; 175 color: #f00;
160 } 176 }
161 - input{ 177 + input {
162 border: 0; 178 border: 0;
163 outline: 0; 179 outline: 0;
164 width: 80%; 180 width: 80%;