是用vue構(gòu)建的項(xiàng)目,在微信瀏覽器下同樣的頁面請(qǐng)求,只會(huì)在iphone下出現(xiàn),而且是在https的情況下出現(xiàn)(而且并不是100%出現(xiàn),大概50%的概率出現(xiàn)吧),http的不會(huì)這種問題,vue-resource和jquery的請(qǐng)求方法我都試了,插件造成原因大概可以排除,報(bào)錯(cuò)的原因是XMLHttpRequest.readyState為0,XMLHttpRequest對(duì)象沒有初始化,在vue中造成這種情況的原因大概率是什么情況下面是用jquery報(bào)錯(cuò)打印出的代碼{ "readyState": 0, "status": 0, "statusText": "error" }下面是vue-resource簡(jiǎn)單的測(cè)試代碼<script>import {testUrl} from 'common/config'export default { data(){ return{ content:'還沒加載數(shù)據(jù)', status:'請(qǐng)求狀態(tài)' } }, mounted() { this.Request() }, methods: { Request(){ this.content='開始加載中...' this.$http({ method:'GET', url:testUrl }).then((res)=>{ this.status='請(qǐng)求成功' this.content = res // alert('請(qǐng)求成功') }).catch((err)=>{ this.status='請(qǐng)求失敗' this.content = err // alert('請(qǐng)求失敗') }) } }}</script>
微信瀏覽器中的XMLHttpRequest.readyState為0
有只小跳蛙
2019-03-01 11:11:11