Vue獲取微博授權(quán)URL代碼實例
1.在Vue頁面加載時動態(tài)發(fā)送請求獲取微博授 權(quán)url
1.1 在 componentscommonlab_header.vue 中寫oauth動態(tài)獲取微 博授權(quán)URL
// 獲取微博登錄地址oauth() {// 從后端獲取 微博登錄地址oauth_post().then((resp) => {console.log(resp)//{’code’: ’0’, ’msg’: ’成功’, ’data’: {’url’: url}}let url = resp.data.url;this.weibo_url = url;})},
1.2 在vue的mounted函數(shù)中調(diào)用獲取微博授權(quán)url函數(shù)
mounted() {this.oauth()},
1.3 點擊'登錄'彈出的form表單中加入url
<formaction='/login'method='post'><div class='form-group widget-signin'><a :href='http://www.lshqa.cn/bcjs/weibo_url' rel='external nofollow' ><i class='fa fa-weibo'></i></a></div></form>
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章: