如何用uni-app在小程序中实现长尾词登录注册功能?
- 内容介绍
- 文章标签
- 相关推荐
本文共计919个文字,预计阅读时间需要4分钟。
思路:1. 使用微信的 `open-type=getUserInfo` 获取用户信息,将用户信息保存到 `userinfoDetails` 对象中。按钮 `v-else` 设置为 `type=primary`,类名为 `reserve-btn`,使用 `open-type=getUserInfo` 并绑定 `@getuserinfo=getuserinfo` 事件用于预约挂号。
思路:
1.使用微信的open-type="getUserInfo" 获取用户信息,将用户信息保存到userinfoDetails对象中去。
<button v-else type="primary" class="reserve-btn" open-type="getUserInfo" @getuserinfo="getuserinfo">预约挂号</button>
2.使用uni.login() 获取code,并且把code传给后台,后台会返回openid
3.使用vuex和本地缓存保存相关状态值
备注vuex和本地缓存的区别:
vuex是响应式更新,页面不刷新数据也会实时更新,但是页面一刷新,数据可能会失效
本地缓存不会响应式更新,但是一刷新本地缓存就会更新。
本文共计919个文字,预计阅读时间需要4分钟。
思路:1. 使用微信的 `open-type=getUserInfo` 获取用户信息,将用户信息保存到 `userinfoDetails` 对象中。按钮 `v-else` 设置为 `type=primary`,类名为 `reserve-btn`,使用 `open-type=getUserInfo` 并绑定 `@getuserinfo=getuserinfo` 事件用于预约挂号。
思路:
1.使用微信的open-type="getUserInfo" 获取用户信息,将用户信息保存到userinfoDetails对象中去。
<button v-else type="primary" class="reserve-btn" open-type="getUserInfo" @getuserinfo="getuserinfo">预约挂号</button>
2.使用uni.login() 获取code,并且把code传给后台,后台会返回openid
3.使用vuex和本地缓存保存相关状态值
备注vuex和本地缓存的区别:
vuex是响应式更新,页面不刷新数据也会实时更新,但是页面一刷新,数据可能会失效
本地缓存不会响应式更新,但是一刷新本地缓存就会更新。

