当前位置:网站首页>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 .
边栏推荐
- 蚂蚁庄园安全头盔 7.8蚂蚁庄园答案
- On the discrimination of "fake death" state of STC single chip microcomputer
- 外设驱动库开发笔记43:GPIO模拟SPI驱动
- C面试24. (指针)定义一个含有20个元素的double型数组a
- 牛客小白月赛52 E.分组求对数和(二分&容斥)
- 骑士战胜魔王(背包&dp)
- A freshman's summary of an ordinary student [I don't know whether we are stupid or crazy, but I know to run forward all the way]
- 3531. 哈夫曼树
- 「解析」FocalLoss 解决数据不平衡问题
- 缓存在高并发场景下的常见问题
猜你喜欢
随机推荐
哈趣投影黑馬之姿,僅用半年强勢突圍千元投影儀市場!
力扣62 不同路径(从矩阵左上到右下的所有路径数量) (动态规划)
postgresql 数据库 timescaledb 函数time_bucket_gapfill()报错解决及更换 license
10W word segmentation searches per second, the product manager raised another demand!!! (Collection)
缓存在高并发场景下的常见问题
软件测试知识储备:关于「登录安全」的基础知识,你了解多少?
Oracle迁移中关于大容量表使用数据泵(expdp、impdp)导出导入容易出现的问题和注意事项
Introduction to yarn (one article is enough)
Audio distortion analysis of DSP and DAC based on adau1452
POI导出Excel:设置字体、颜色、行高自适应、列宽自适应、锁住单元格、合并单元格...
ICML 2022 | 探索语言模型的最佳架构和训练方法
3428. 放苹果
Qtthread, one of many methods of QT multithreading
ceres-solver和g2o性能比较
【OpenCV】形态学滤波(2):开运算、形态学梯度、顶帽、黑帽
软件测试的几个关键步骤,你需要知道
JVM 全面深入
If you don't know these four caching modes, dare you say you understand caching?
ST表预处理时的数组证明
港科大&MSRA新研究:关于图像到图像转换,Fine-tuning is all you need