当前位置:网站首页>How to use wechat cloud hosting or cloud functions for cloud development of unapp development applet
How to use wechat cloud hosting or cloud functions for cloud development of unapp development applet
2022-07-07 06:23:00 【Aasee.】
One . Apply for wechat cloud hosting
Needless to say, it's necessary , Official address Here . Just go in and apply .
But the premise is that you have to be able to create docker file, Learn to master some basic docker knowledge , It will make it easier for you to create an environment . After the environment is created, the following operations can be carried out .
Two . So let's create one cloudfunctions Folder
like this , Just put an empty file in it js ah css Anything will do , In this way, subsequent copies can be made .
Configuration path
Then we can go uniapp Inside manifest.json
File configuration cloudfunctions
The location of the folder , Take me as an example
"cloudfunctionRoot": "cloudfunctions/"
because uniapp This file will not be compiled to mp-weixin platform , So here we copy it . Here I also refer to The code for this article . Download a plug-in first .
npm install -save [email protected]
After the download is complete, go to vue.config.js
The file is configured as follows
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')
}
])
]
}
}
find uniapp The files created in are compiled into packages in the corresponding environment .
You should know the path .
Just write down your own path .
3、 ... and . initialization , Then you can call .
One . initialization
stay App.vue
In the document onLounch Add
This is directly in Official wechat documents You can also see .
Two . Calling method
Here you can go directly to uniapp Wechat cloud hosting service is used in , Of course, if you really feel troublesome, you can also use the opening directly https Server for use , You can also use uniapp Officially recommended unicloud service .
边栏推荐
- POI excel export, one of my template methods
- jmeter 函数助手 — — 随机值、随机字符串、 固定值随机提取
- ST表预处理时的数组证明
- 面试中有哪些经典的数据库问题?
- 力扣62 不同路径(从矩阵左上到右下的所有路径数量) (动态规划)
- A very good JVM interview question article (74 questions and answers)
- 如何解决数据库插入数据显示SQLSTATE[HY000]: General error: 1364 Field ‘xxxxx‘ doesn‘t have a default value错误
- Sequential storage of stacks
- C语言面试 写一个函数查找两个字符串中的第一个公共字符串
- c语言面试写一个函数在字符串N中查找第一次出现子串M的位置。
猜你喜欢
On the discrimination of "fake death" state of STC single chip microcomputer
【OpenCV】形态学滤波(2):开运算、形态学梯度、顶帽、黑帽
3428. Put apples
Career experience feedback to novice programmers
进程间通信之共享内存
uniapp开发小程序如何使用微信云托管或云函数进行云开发
高并发大流量秒杀方案思路
软件测试知识储备:关于「登录安全」的基础知识,你了解多少?
matlab / ENVI 主成分分析实现及结果分析
Several key steps of software testing, you need to know
随机推荐
Knight defeats demon king (Backpack & DP)
K8s running Oracle
Check point: the core element for enterprises to deploy zero trust network (ztna)
3428. 放苹果
基本Dos命令
A very good JVM interview question article (74 questions and answers)
基于FPGA的VGA协议实现
rt-thread 中对 hardfault 的处理
JVM命令之 jstat:查看JVM統計信息
Jcmd of JVM command: multifunctional command line
C note 13
安装mongodb数据库
港科大&MSRA新研究:关于图像到图像转换,Fine-tuning is all you need
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
postgresql 数据库 timescaledb 函数time_bucket_gapfill()报错解决及更换 license
CloudCompare-点对选取
Open the blue screen after VMware installation
Jinfo of JVM command: view and modify JVM configuration parameters in real time
谷歌 Chrome 浏览器发布 103.0.5060.114 补丁修复 0-day 漏洞
字符串常量与字符串对象分配内存时的区别