欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

 更新時間:2020年11月04日 11:58:57   作者:周曉楠  
這篇文章主要介紹了Vue獲取微博授權URL代碼實例,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友可以參考下

1.在Vue頁面加載時動態(tài)發(fā)送請求獲取微博授 權url

1.1 在 components\common\lab_header.vue 中寫oauth動態(tài)獲取微 博授權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

<form
  action="/login"
  method="post"
>
  <div class="form-group widget-signin">
    <a :href="weibo_url" rel="external nofollow" ><i class="fa fa-weibo"></i></a>
  </div>
</form>

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

相關文章

最新評論