Micro letter applet study notes three

WXSS style

  1. Files

    Here Insert Picture Description

    Project common style: it will be injected into every page applet;

    Page Style: Registration and app.json through the pages of the same name and the location of the same level WXSS file;

    Other styles: can be referenced items common style and page styles,

  2. measurement unit

    RPX, to 375 physical pixels as a reference, i.e. a physical width of 375 pixel screen, 1rpx = 1px

  3. WXSS quote

    CSS , developers such references another style file@import url('./test_0.css')

    This method on the request will not be incorporated into the test_0.css index.css, that is, when index.css request, the request will be more of a test_0.css.

    Applet style references are written,@import './test_0.wxss'

    Since WXSS package will eventually be compiled into object files, users only need to download once, will not file the request because the reference pattern generated excess during use.

  4. Inline style

    Within WXSS inline style Web development is consistent with the

    Applet support dynamic updates inline style

    <!--index.wxml-->
    <!--可动态变化的内联样式-->
    <!--
    {
        eleColor:'red',
        eleFontsize:'48rpx'
    }<
    -->
    <view style="color:{{eleColor}};font-size:{{eleFontsize}}"><view/>
    
  5. Selector

    Types of Selector Sample Sample Description
    Class selector .class .intro Select all the components have class = "intro" of
    id selector #id #firstname Component selection has id = "firstname" of
    Element selector element view checkbox Select all the components of the document and view all components checkbox
    Pseudo-element selector ::after view::after An insert in the rear view assembly
    Pseudo-element selector ::before view::before Inserts assembly in front view

    Here Insert Picture Description

  6. Official Style Library

JS script

  1. IT IS

    Here Insert Picture Description
    Here Insert Picture Description
    Here Insert Picture Description

  2. Applet execution environment

    Applet currently running on three platforms:

    • iOS platforms, including iOS9, iOS10, iOS11

    • Android platform

    • Applet IDE -> syntax transcoding tool, ES6-> ES5

  3. Modular

    Browser, all running in the same scope JS, parameters or methods defined script can be accessed or loaded subsequent rewriting;

    Applets, can be any one of the JS file as a module, through module.exportsor exportsoutside exposed interfaces

  4. Script execution order

    Browser, in strict accordance with the order of loading

    Inlet applet file is executed app.js, according to the order in which the module determines the file require run sequence

  5. Scope

    Scope of the program with little more similar NodeJS

    • Variable and function declarations in the file is only valid in the file, a different file can declare variables and functions the same name, do not affect each other;

    • Need to use global variables by using a global function getApp () obtain an instance of a global, and set the associated property values, global variables available to achieve the object set;

    • Examples of global variables have to get gatApp()

      //访问全局变量
      var global = getApp()
      console.log(global.globalValue)
      

      When the need to ensure that global data may be safe to use in any document, it needs to App()be set in

Published 26 original articles · won praise 6 · views 1394

Guess you like

Origin blog.csdn.net/qiao_xi/article/details/104080396