vue获取微博授权url

时间:2020-10-09 21:25:35   收藏:0   阅读:31

1.在Vue页面加载时动态发送请求获取微博授权url

  1.1 在components\common\lab_header.vue中写oauth动态获取微 博授权URL

  

// 获取微博登录地址
oquth(){
       oauth_post().then((resp) => {
            console.log(resp)
            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"><i class="fa fa-weibo"></i></a>  </div> </form>

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!