Commit 145c620a3a3bb0a67a068708ecaf76cc5fb14f05

Authored by liuqimichale
1 parent 8da434bf

传值

src/components/home.vue
... ... @@ -2,7 +2,7 @@
2 2 <div class="wrap">
3 3 <InOut v-if="inOutVal==='1'" :toflag = "0"/>
4 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 6 <Loading v-show="_getshowflag"/>
7 7 </div>
8 8 </template>
... ... @@ -40,10 +40,10 @@ export default {
40 40 // console.log(response)
41 41 // })
42 42 // },
43   - this.handlePayFlag()
  43 + // this.handlePayFlag()
44 44 console.log(this._getPayFlag)
45   - this.title = '手机: 13911137584'
46   - this.money = '¥100.00'
  45 + // this.title = '手机: 13911137584'
  46 + // this.money = '¥100.00'
47 47 }, 2000)
48 48 },
49 49 methods: {
... ... @@ -51,7 +51,12 @@ export default {
51 51 'handleHide',
52 52 'handleShow',
53 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 62 </script>
... ...
src/components/inout.vue
1 1 <template>
2 2 <div class="inout-wrap">
3 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 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 19 <div class="toggle-btn" @click="togglebtn">
9 20 <img src="../assets/toggle-btn.png">
10 21 {{ toggleText }}
... ... @@ -64,6 +75,11 @@ export default {
64 75 this.tipsClass = 'successClass'
65 76 if (this.toflag === 1) {
66 77 this.handlePayFlag()
  78 + const passdata = {
  79 + title: '手机号123',
  80 + money: '¥1000.00'
  81 + }
  82 + this.$emit('commitpass', passdata)
67 83 }
68 84 }, 2000)
69 85 } else {
... ... @@ -158,7 +174,7 @@ export default {
158 174 .errorClass {
159 175 color: #f00;
160 176 }
161   - input{
  177 + input {
162 178 border: 0;
163 179 outline: 0;
164 180 width: 80%;
... ...