WeChat Mini Program Development Diary 1

Ahhhh, the first day of learning WeChat applets! ! !

 This interface is so cool, I like it! ! !

 Well, an error was reported the first time I compiled it, let me see which brat it is. . .

First of all - copy error, Baidu -

Small program-- [sitemap index status reminder] According to the sitemap rule [0], the current page [pages/index/index] will be indexed_Muizai's blog-CSDN blog This blogger said - this warning has told us that It belongs to the sitemap index status reminder. Let’s search the sitemap in the official WeChat document and find that it can be configured in project.config.json. There is a checkSiteMap configuration item, which is true by default. If it is changed to false, the sitemap warning will not be reported. .

OK! open! ! ! Here is the project.config.json page:

 

Input: "checkSiteMap": False, it turned red! ! ! Okay, it’s still Baidu— the configuration of checkSitMa in the project.config.json file shows an error, what is the problem? | WeChat Open Community (qq.com)

The blogger’s local settings are called from Settings-Project Settings, and do not verify legal domain names, web-view (business domain names), TLS versions, and HTTPS certificates

This item needs to be ticked, which is as follows:

Well, the console error is gone, but I still can’t compile it, because there is a problem with issues again (I want to cry) and I can’t find the reason,,,

Well, I have a good teacher, he is willing to help me, pointing out that my mistake is that the home page in my app.json is not imported into the program, and I need to adjust "pages/home/home" in " The front of the pages", after modification——

 Ok, it's compiled——

 Add to my code:

home.wxml



<!--pages/home/home.wxml-->
<text>pages/home/home.wxml</text>


<!--三元运算-->
<view hidden="{
   
   {showTest ? '显示内容' : '不显示内容'}}"> </view>
<!--算术运算-->
<view>{
   
   {a+b}}+1+{
   
   {c}}+d=?</view>
<!--逻辑运算-->
<view wx:if="{
   
   {length > 5}}">1</view>
<!--字符串运算-->
<view>{
   
   {"hello"+name}}</view>
<!--数据路径运算-->
<view>{
   
   {object.key}} {
   
   {array[0]}}</view>

home.js

// pages/home/home.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    showTest:false,
    a:1,
    b:2,
    c:3,
    d:4,
    length:5,
    name:'小程序',
    object:{
      key:25
    },
    array:['arr1','arr2']

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})

app.json

{
  "pages": [
    "pages/home/home",
    "pages/index/index",
    "pages/logs/logs"
  ],
  "window": {
    "backgroundTextStyle": "light",
    "navigationBarBackgroundColor": "#fff",
    "navigationBarTitleText": "Weixin",
    "navigationBarTextStyle": "black"
  },
  "style": "v2",
  "sitemapLocation": "sitemap.json",
  "lazyCodeLoading": "requiredComponents"
}

Effect:

Ok, let's do the next program:

Create a new exex folder, but it does not automatically configure the four files in the folder like creating a home file, Baidu——

(2 messages) WeChat applet quickly creates pages and automatically generates files

In the app, the json configuration file directly writes the page path, and the corresponding folder and corresponding .js .json .wxml .wxss will be automatically generated

The result after adding:

 Next:

code:

exex.wxml

<!--pages/exex/exex.wxml-->
<text>pages/exex/exex.wxml</text>

<wxs module="m1">
var msg="hello world";
module.exports.message=msg;
</wxs>
<view>{
   
   {m1.message}}</view>

 Summary: wxs file

Example 3:

Guess you like

Origin blog.csdn.net/qq_46486280/article/details/126865219