您的位置:首頁技術文章
文章詳情頁

Vue獲取微博授權URL代碼實例

瀏覽:91日期: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.wxshucaidpc.com/bcjs/weibo_url' rel='external nofollow' ><i class='fa fa-weibo'></i></a></div></form>

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網。

標簽: 微博
相關文章:
国产综合久久一区二区三区