当前位置:网站首页>Wechat applet - day 4
Wechat applet - day 4
2022-04-22 22:24:00 【Eat together my】
uni-app: It's a use Vue.js Develop a framework for all front-end applications . Official website
Conditional compilation : Conditional compilation is marked with special comments , Based on these special comments at compile time , Compile the code in the comments to different platforms .
#ifndef H5
Code to be conditionally compiled
#endif H5 platform
#ifndef MP-WEIXIN
Code to be conditionally compiled
#endif Wechat applet
loginFn() {
// #ifdef MP-WEIXIN
this.wxLogin()
// #endif
// #ifdef H5 || APP-PLUS
uni.navigateTo({
url: '/pkgUser/login/login'
})
// #endif
},
wxLogin() {
let userInfo = ''
let code = ''
uni.getUserProfile({
desc: " Get user information ",
success: res => {
userInfo = res
// console.log(userInfo)
this.sendLogin(code, userInfo)
}
})
uni.login({
success: res => {
code = res.code
this.sendLogin(code, userInfo)
// console.log(code)
}
})
},
async sendLogin(code, userInfo){
if(!code || !userInfo) return
console.log(code)
let res = await uni.$axios.post(' route ',{userInfo,code})
// onsole.log(res)
this.$store.commit('user/setToken', res.token)
this.$store.commit('user/setUserInfo', res.userInfo)
}
You can quickly create components :1、 establish components Folder =>2、 Right click new component
3、 You can use... Within the page <search/> Tags introduced
Can support vuex:
map Method name ([' Properties or methods ']) mapping vuex The data or method of the root module
map Method name (‘ Module name ’,[' Properties or methods ']) Map the data or methods of a module
uni-app Integrated vue Content related to wechat applet development , The specific implementation method needs to consult the official documents
版权声明
本文为[Eat together my]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221450487803.html
边栏推荐
- Extended practice of chrome devtools inspector
- RPCX源码学习-client端
- 智汀如何连接小米智能音箱?
- KunlunDB对MySQL私有DML语法的支持
- Is it necessary to read the history of mathematics? We have neglected too much about mathematics education
- Huawei switch configuration
- 智能名片小程序名片详情页功能实现关键代码
- 机器越“智能”,数据标注员越容易被淘汰?丨曼孚科技
- Secret of 66% performance surge: AMD 25000 yuan 768mb 3D cache Xiaolong opened the cover for the first time
- 集简云 x ServiceGo:助力硬件制造商实现设备报修、维修智能化管理
猜你喜欢

京东一面:子线程如何获取父线程 ThreadLocal 的值?我蒙了。。。

pcba/ IPQ6010 802.11ax 2x2 2.4G&5G /2.5Gbps Ethernet Port

muduo源码分析之Buffer

Extended practice of chrome devtools inspector
![[untitled]](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
[untitled]

The accuracy of this gyroscope is too high. It is recommended to prohibit its use.

每周问答精选:PolarDB-X 完全兼容 MySQL 吗?

Vulnerability utilization in 2021: 95% of traditional vulnerabilities have been disclosed

如何做一款成功的开源项目

In the era of Internet of all things, how should smart home ecosystems such as Xiaomi, apple and Huawei be selected?
随机推荐
Function pointer and callback function
云融科技加入龙蜥社区,助力金融行业数字化转型
Lightly:新一代的 Go IDE
SAP ui5 application development tutorial 71 - nested routing trial version of SAP ui5 page
Explain business agility in cloud computing in detail
Why is bi so important to enterprises?
OPLG:新一代云原生可观测最佳实践
JS intercept file suffix
TCP/IP 协议及网络分层模型
What should web testing pay attention to?
Instructions of crystal Chem soybean ELISA Kit II
Crashsight general function & feature function introduction
The head is fixed on the ceiling, less than one screen of footer is fixed on the bottom, and more than one screen scrolls. Pay attention to the notes
LeetCode-238-除自身以外数组的乘积
IvorySQL亮相于PostgresConf SV 2022 硅谷Postgres大会
Web测试需要注意什么?
How to use lightly to teach programming classes gracefully?
Series interpretation of smc-r (II): smc-r communication technology integrating TCP and RDMA
343 leetcode inverts vowels in a string
智汀如何连接小米智能音箱?