Origin: Due to my obsession with robots, the store is about to close down. I have no choice but to spend some energy to create a small program for the store. I have to sell more goods to survive and engage in robots. I will record the process of creating the small program here. Otherwise, I will Finished and forgotten. Tencent's cloud development has front-end and back-end, and you don't have to look for a server anymore. It's simple and hassle-free.
1. Download the mini program tool
2. Create a small program
3. Initialization applet
1 Delete the quickstartFunctions folder in the cloudfunctions folder
2 Delete the cloudTipModal folder under miniprogram\components
Clear all images in 3images folder
4 Only the index folder is kept in the pages folder, and the others are deleted.
5 Modify the files in the index folder
index.js clears the data and only retains the function frame
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
indxe.json
{
"usingComponents": {
}
}
index.wxml
<!--index.wxml-->
<view>首页</view>
4 app.json
{
"pages": [
"pages/index/index"
],
"window": {
"backgroundColor": "#F6F6F6",
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#F6F6F6",
"navigationBarTitleText": "自己小程序名",
"navigationBarTextStyle": "black"
},
"sitemapLocation": "sitemap.json",
"style": "v2"
}
5 app.wxss Clear all contents
6. It doesn’t matter if the app.js env parameters are modified or not.
wx.cloud.init({
// env 参数说明:
// env 参数决定接下来小程序发起的云开发调用(wx.cloud.xxx)会默认请求到哪个云环境的资源
// 此处请填入环境 ID, 环境 ID 可打开云控制台查看
// 如不填则使用默认环境(第一个创建的环境)
env: 'cloud1-5gxjyqlndxxxxx',
traceUser: true,
});
7 compile
Seeing this and no error is reported, it means that the initialization is completed and you can start making your own small program from 0.