Home>Article>WeChat Applet> Summarize and organize common form components of WeChat mini programs
This article brings you relevant knowledge aboutWeChat Mini Program, which mainly introduces some common form components, including button, checkbox, input, label and other related issues. The following is Let's take a look, hope it helps everyone.
【Related learning recommendations:小program learning tutorial】
is a button component, which is one of the commonly used form components and is used for event triggering and form submission. Its attribute table is shown below.
Code example:
7.button小案例 (1)迷你按钮 (2)按钮状态 (3)增加按钮事件
1.2 checkbox
is a check box component, often used to select multiple data in a form. The
of the check box is the parent control, and several
child controls are nested inside it.
The attributes are as follows:
##
Code example:
checkbox.wxmlcheckbox.js8.checkbox小案例 利用for循环批量生成
Page({ data: { items: [ { name: "tiger", value: "老虎" }, { name: "elephant", value: "大象" }, { name: "lion", value: "狮子", checked: "true" }, { name: "penguin", value: "企鹅" }, { name: "elk", value: "麋鹿" }, { name: "swan", value: "天鹅" }, ] }, checkboxChange:function(e) { console.log("checkbox发生change事件,携带value值为:", e.detail.value) }})
1.3 input
is an input box component, often used for inputting text (such as name, age, etc.). The attribute table is as follows:9.input小案例 (1)文字输入框 (2)密码输入框 (3)禁用输入框 (4)为输入框增加事件监听
1.4 label
is the label component , will not render any effect, but can be used to improve the usability of form components. When the user clicks the text within the label element, this control will be triggered. That is, when the user selects the label, the event will be passed to the form control related to the label. You can use the for attribute to bind the id, or you can put the space in Inside the tag, the corresponding properties of the component are as follows.wxml
1.5 form is the form control component, used to submit the form content in the component.10.lable小案例 (1)利用for属性 (2)label包裹组件
The above is the detailed content of Summarize and organize common form components of WeChat mini programs. For more information, please follow other related articles on the PHP Chinese website!