Home > front end >  Small program introduction to 1
Small program introduction to 1

Time:11-26

app. Json global configuration file
"Pages" : control page routing, receiving an array, the array is page path, if the path to the file does not exist, the automatically created
"The window" : control information page window, background prefix control background; NavigationBar prefix control at the top of the navigation bar

page in the folder page
Features: when a page configuration properties and global app. Json phase at the same time, will be preferred to use local configuration

data binding syntax
You can also use three expression etc.
 & lt; View> {{variable values}} & lt;/view> 


loop syntax
 wx: for="{{array name}}" 
, the default value for the item, the default for the index of
Change the default value to use
 wx: the for - item='custom variable name 
'
Modified index in
 wx: the for - index='custom index name 

Like the vue iterates need to bind only value
 wx: key="string" 
(can also be reserved keywords - * this * this on behalf of the item itself in a for loop)

Block is an empty tag can be used to write loop labels, tags or judgment, will not appear on the page
 

Said object attribute values: {{item}}
Said the object's key values: {{index}}




judging grammar
Wx: if="condition a"
Wx: elif="condition 2
"Wx: else

hidden used to hide, and if the difference is hidden as hidden content, while the if can destroy the content
Is similar to the v - show, vue judgment condition is true, content is the difference hidden

event handling
Key words: bind event name='function name'
If you need to pass parameters, you may need to participate in custom parameters in the label data - parameter name
Values need to be passed in the function and obtain the handle (e) {urrentTarget of e.c. with our fabrication:. The dataset. Parameter name}

binding input events
1. Through input events for input content
WXML listening in the input box information
 

Js method function defined in
 
Function the method name (e) {
E.d etail. Value
}


2. Through simple two-way binding obtain input content
WXML used in
 & lt; View> 
User name: & lt; Input type="text" model: value="https://bbs.csdn.net/topics/{{userName}}"/& gt;




Js in
 
Data {
The userName: '
},
GetUserName () {
The console. The log (this. Data. The userName)
}


WXSS
Most compatible CSS features, and based on CSS expand
1. The response type unit the RPX
The full screen width positioning the RPX, similar to rem

2. Style import
Using the @ import import external style sheet, followed by a relative path, use; Said the statement
For example, in the same directory have common. WXSS stylesheet
The page folder WXSS file
@ import "is common. WXSS";


image component image

Mode: the picture shows the way
The most commonly used
WidthFix - set the width of the picture, the height will be adaptive, images will display all

  • Related