Micro-channel applet -day2

day2
global configuration 1.app.json
Pages and the: Page path list
windows: the global default window performance
tabBar: the performance of the bottom tab bar
2.pages is used to specify which pages consisting of applets, file name, file extension does not need to write, frame will automatically find
the status bar 3.Windows program for designing small, the navigation bar, the title, the window background color
using 4-specific data in the wxml
1. data binding
data are dynamic data from the corresponding wxml Page in the
data use Mustache binding syntax (curly brackets) variable wrap
1. simple binding
example: <View> Message {} {} </ View>
Page ({
Data: {
Message: '! MINA the Hello'
}
})
2 component binding properties (within the required double quotes)
For example: <View ID = "Item - {{ID}}"> </ View>
Page ({
Data: {
ID: 0
}
})
3. control properties, We have the keyword in double quotes
2. renderer list
on the assembly using wx: for a binding property of the control array, the array can be used to render the data repetition assembly
Default subscript of an array variable name defaults to the current item index, an array of variable current default item name of the item
at this time wx: for loop similar
example:
<View wx: for = "{{}} Array">
{{ }} index: item.message {{}}
</ View>
Page ({
Data: {
Array: [{
Message: 'foo',
}, {
Message: 'bar'
}]
}
})
This code: displayed Message: Message foo: bar
1. use wx: for-item can specify the variable name of the current array element
2. wx: for-index to specify the current array subscript variable name
example:
<View WX: for = "{{array }} "WX: for-index =" IDX "WX: for-Item =" itemName ">
{{}} IDX: itemName.message {{}}
</ View>
data array in the circular array, will be named IDX, itemName
3. conditions rendered
in the frame, using wx: if = ""Whether it is necessary to render the code block:
<View WX: IF = "{{}} for condition Condition"> True </ View>
Of course, can be added else block
4. The template
WXML providing a template (template), the code may be defined in the template fragment, in different places and then call
1. First define a template:
the name attribute, as the name for the template and the template is defined in the fragment
<Template name = "msgItem">
<View>
<text> {{index}}: {{MSG}} </ text>
<text> Time: {{Time}} </ text>
</ View>
< / template>
2. the use of templates:
use is attribute declaration need to use the template, the template and the desired incoming data
<= template is "msgItem" data = "Item {{...}}" />
. 5 a reference
WXML provides two reference file and import the include
1.import
use:
import can use the target file defined in the template file, such as:
define a template called item in item.wxml in:
! <- item .wxml ->
<Template name = "Item">
<text> {{text}} </text>
</template>
Item.wxml cited in index.wxml, you can use the item template:
<Import the src = "item.wxml" />
<Template IS = "item" Data = "{{text: 'forbar'}}" />
the explanation is simple: use of other things must declare: As used herein,
<import src = "item.wxml" / >
scope:
C Import B, B Import a, C may be used in the B-defined template, can be in B a use as defined template, but can not use the C-defined template a
simple statement: who introduced, who use
2.include
include object files except <template /> <wxs /> outside may be introduced into the entire code, is copied to include equivalent position
using:
<the include the src = "header.wxml" />
<View> body </ View>
<the include the src = "footer.wxml" />

Guess you like

Origin www.cnblogs.com/FlowerNotGiveYou/p/11111734.html