当前位置:网站首页>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 .
边栏推荐
- LM小型可编程控制器软件(基于CoDeSys)笔记二十三:伺服电机运行(步进电机)相对坐标转换为绝对坐标
- Jstat pour la commande JVM: voir les statistiques JVM
- [SOC FPGA] custom IP PWM breathing lamp
- 微信小程序隐藏video标签的进度条组件
- VMware安装后打开就蓝屏
- 计算模型 FPS
- Audio distortion analysis of DSP and DAC based on adau1452
- POI excel export, one of my template methods
- 3428. 放苹果
- rt-thread 中对 hardfault 的处理
猜你喜欢

安装VMmare时候提示hyper-v / device defender 侧通道安全性

rt-thread 中对 hardfault 的处理

POI导出Excel:设置字体、颜色、行高自适应、列宽自适应、锁住单元格、合并单元格...

laravel 使用腾讯云 COS5全教程

Financial risk control practice - decision tree rule mining template

生活中的开销,怎么记账合适

Jstat of JVM command: View JVM statistics

On the discrimination of "fake death" state of STC single chip microcomputer

基于ADAU1452的DSP及DAC音频失真分析

C note 13
随机推荐
3531. Huffman tree
安装mongodb数据库
3531. 哈夫曼树
可极大提升编程思想与能力的书有哪些?
Redis(二)—Redis通用命令
高并发大流量秒杀方案思路
360 Zhiyu released 7.0 new products to create an exclusive "unified digital workspace" for the party, government and army, and central and state-owned enterprises
Ant manor safety helmet 7.8 ant manor answer
Implementation of VGA protocol based on FPGA
Several key steps of software testing, you need to know
c语言(结构体)定义一个User结构体,含以下字段:
计算模型 FPS
VMware安装后打开就蓝屏
Oracle迁移中关于大容量表使用数据泵(expdp、impdp)导出导入容易出现的问题和注意事项
[FPGA] EEPROM based on I2C
Check point: the core element for enterprises to deploy zero trust network (ztna)
MySQL(十)
[shell] summary of common shell commands and test judgment statements
Talking about reading excel with POI
PostgreSQL database timescaledb function time_ bucket_ Gapfill() error resolution and license replacement