当前位置:网站首页>uniapp开发小程序如何使用微信云托管或云函数进行云开发
uniapp开发小程序如何使用微信云托管或云函数进行云开发
2022-07-07 01:43:00 【Aasee.】
一. 申请微信云托管
这个不用说吧必须的,官方地址在这。直接进去申请就行。
但是前提是你得会创建docker file,学习掌握一些基本的docker知识,会让你创建环境变得简单一点。环境创建完成之后就能进行下面的操作了。
二. 先创建一个cloudfunctions文件夹
像这样,在里面放一空文件就行什么js啊css什么的都行,这样才能进行后续的拷贝。
配置路径
然后我们就可以去uniapp里的manifest.json
文件里配置cloudfunctions
文件夹的位置了,以我这为例子就是
"cloudfunctionRoot": "cloudfunctions/"
因为uniapp不会将这个文件编译到mp-weixin平台,所以这里我们把它拷贝过去。这里我也是参考了这篇文章的代码。先下载一个插件。
npm install -save [email protected]
下载完成后在vue.config.js
文件中进行如下配置
const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')
module.exports = {
configureWebpack: {
plugins: [
new CopyWebpackPlugin([
{
from: path.join(__dirname, 'cloudfunctions'),
to: path.join(__dirname, 'try-music/dist', process.env.NODE_ENV === 'development' ? 'dev' : 'build', process.env.UNI_PLATFORM, 'cloudfunctions')
}
])
]
}
}
找到uniapp中创建的文件编译到相应环境下的包内。
这个大家应该知道路径吧。
把你们自己的路径对应写上就行。
三. 初始化,然后就能调用了。
一.初始化
在App.vue
文件中的onLounch中加入
这个直接在微信官方文档也能查看。
二 .调用方法
到这里你就可以直接在uniapp中使用微信云托管服务了,当然如果实在觉得麻烦你也可以直接使用开通https的服务器进行使用,也可以使用uniapp官方推荐的unicloud服务。
边栏推荐
- 那些自损八百的甲方要求
- JVM monitoring and diagnostic tools - command line
- How to set up in touch designer 2022 to solve the problem that leap motion is not recognized?
- MySQL performance_ Schema common performance diagnosis query
- Change the original style of UI components
- C语言面试 写一个函数查找两个字符串中的第一个公共字符串
- rt-thread 中对 hardfault 的处理
- Redis(一)——初识Redis
- The boss always asks me about my progress. Don't you trust me? (what do you think)
- Subghz, lorawan, Nb IOT, Internet of things
猜你喜欢
关于STC单片机“假死”状态的判别
【FPGA教程案例14】基于vivado核的FIR滤波器设计与实现
@Detailed differences between pathvariable and @requestparam
高并发大流量秒杀方案思路
安装VMmare时候提示hyper-v / device defender 侧通道安全性
If you don't know these four caching modes, dare you say you understand caching?
Rk3399 platform development series explanation (WiFi) 5.52. Introduction to WiFi framework composition
JMeter's own functions are not enough? Why don't you develop one yourself
JVM命令之- jmap:导出内存映像文件&内存使用情况
ML's shap: Based on the adult census income binary prediction data set (whether the predicted annual income exceeds 50K), use the shap decision diagram combined with the lightgbm model to realize the
随机推荐
Jstack of JVM command: print thread snapshots in JVM
win系统下安装redis以及windows扩展方法
Rk3399 platform development series explanation (WiFi) 5.52. Introduction to WiFi framework composition
职场经历反馈给初入职场的程序员
k8s运行oracle
Software testing knowledge reserve: how much do you know about the basic knowledge of "login security"?
c语言面试写一个函数在字符串N中查找第一次出现子串M的位置。
POI excel export, one of my template methods
Markdown 并排显示图片
Introduction to yarn (one article is enough)
直击2022ECDC萤石云开发者大会:携手千百行业加速智能升级
From "running distractor" to data platform, Master Lu started the road of evolution
Test the foundation of development, and teach you to prepare for a fully functional web platform environment
The boss always asks me about my progress. Don't you trust me? (what do you think)
苹果cms V10模板/MXone Pro自适应影视电影网站模板
c语言(结构体)定义一个User结构体,含以下字段:
rt-thread 中对 hardfault 的处理
JVM命令之 jinfo:实时查看和修改JVM配置参数
【FPGA教程案例14】基于vivado核的FIR滤波器设计与实现
Chain storage of stack