#Basic Components

The framework provides developers with a set of basic components that can be combined to achieve quick development. For more information, see Component Documentation.

What is component?

  • A component is the basic building block of a view layer.
  • A component comes with some features and Weixin styles.
  • A component includes a start tag, end tag, property (modifies the component), and content (between the two tags).
<tagname property="value">
Content goes here ...

Note: All components and properties are in lowercase and joined with a hyphen -.

Property Types

Type Description Comment
Boolean Boolean value If a component has this property, the property value is always considered true regardless of what the actual value is. The property value is false only when the component has no this property.
If the property value is a variable, the variable is converted to a Boolean value.
Number Number 1, 2.5
String String "string"
Array Array [ 1, "string" ]
Object Object { key: value }
EventHandler Event handler "handlerName" is the event handler name defined in Page
Any Any property

Common Properties

All components have the following properties:

Property Type Description Comment
id String A unique identifier of a component Remains unique across the entire page.
class String Component style class The style class defined in the WXSS
style String Component inline style This is an inline style that can be dynamically set
hidden Boolean Whether to display the component All components are displayed by default
data-* Any Custom property When an event is triggered on the component, it is sent to the event handler
bind* / catch* EventHandler Component event See Event

Special Properties

Almost all components have their own custom properties. You can modify the features or style of the component. See the definition of each component.