Related syntax and programming micro-letter codes constitute

JSON - Data Format - static configuration

app.json- Page path interface performance + + + tab network timeout bottom
page fields: Page path
status page windows-

{
  "pages":[
    "pages/index/index",
    "pages/logs/logs"
  ],
  "window":{
    "backgroundTextStyle":"light",
    "navigationBarBackgroundColor": "#fff",
    "navigationBarTitleText": "WeChat",
    "navigationBarTextStyle":"black"
  }
}

Tool configuration project.config.json: code package with a project developer tools will help you automatically return to the customized configuration of the time when you develop the project, which will include a color editor, automatic compression codes uploading

Page layout page.json: page-related configuration applet

WXML:

<view class="container">
  <view class="userinfo">
    <button wx:if="{{!hasUserInfo && canIUse}}"> 获取头像昵称 </button>
    <block wx:else>
      <image src="{{userInfo.avatarUrl}}" background-size="cover"></image>
      <text class="userinfo-nickname">{{userInfo.nickName}}</text>
    </block>
  </view>
  <view class="usermotto">
    <text class="user-motto">{{motto}}</text>
  </view>
</view>

wx: if: operation by JS DOM (HTML description tree corresponding to the production) to cause some changes in the behavior of the user interface in response. For example, when the user clicks a button, JS to JS will record some state variables inside while manipulating the DOM attribute or behavior by DOM API, thereby causing some changes in the interface. When the project is getting bigger, your code will be filled with a lot of interactive interface logic and procedures of the various state variables, obviously this is not a good development model, so there was MVVM development model (eg React , Vue), to promote the separation and rendering logic. In short, do not let the JS directly manipulate DOM, JS only need to manage the state, and then to describe the relationship between the state and structure of the interface by means of a template syntax can

Here Insert Picture Description
Here Insert Picture Description

Guess you like

Origin blog.csdn.net/CSDN447447LJH/article/details/91906523