Browse Source

修改 获取href 的问题

feature/feature-compatible
fengchengzhi 7 years ago
parent
commit
1046b93d5f
2 changed files with 10 additions and 14 deletions
  1. 15
      src/view/put-money.vue
  2. 9
      src/view/service-evaluation.vue

15
src/view/put-money.vue

@ -99,20 +99,17 @@
},
//
getParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
// var r = window.location.search.substr(1).match(reg);
var url = 'http://1hjz.3ncto.com.cn/v2/index.html#/put-money?currentAmount=100'
var url = url.substring(0,url.indexOf('?'))
this.$vux.toast.text(url,'middle')
// this.$vux.toast.text(r,'middle')
// if (r != null) return unescape(r[2]);
// return null;
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var url = window.location.href.substring(url.indexOf('?')+1,url.length)
var r = url.match(reg);
if (r != null) return unescape(r[2]);
return null;
}
},
mounted() {
//
this.currentAmount = this.getParam("currentAmount")
this.$vux.toast.text(this.currentAmount,'middle')
}
}
</script>

9
src/view/service-evaluation.vue

@ -174,11 +174,10 @@ export default {
}
},
getParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
// var url = '?name=&time=2018:07:07';
// var r = url.substr(1).match(reg);
if (r != null) return unescape(r[2]);
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var url = window.location.href.substring(url.indexOf('?')+1,url.length)
var r = url.match(reg);
if (r != null) return unescape(r[2]);
return null;
},
//

Loading…
Cancel
Save