文章詳情頁
Vue獲取微博授權URL代碼實例
瀏覽:87日期:2022-06-11 08:50:47
1.在Vue頁面加載時動態發送請求獲取微博授 權url
1.1 在 componentscommonlab_header.vue 中寫oauth動態獲取微 博授權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函數中調用獲取微博授權url函數
mounted() {this.oauth()},
1.3 點擊'登錄'彈出的form表單中加入url
<formaction='/login'method='post'><div class='form-group widget-signin'><a :href='http://www.aoyou183.cn/bcjs/weibo_url' rel='external nofollow' ><i class='fa fa-weibo'></i></a></div></form>
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網。
標簽:
微博
上一條:前端vue如何使用高德地圖下一條:基于vue實現微博三方登錄流程解析
相關文章:
排行榜