You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/api/index.md
+59Lines changed: 59 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1519,6 +1519,8 @@ type: api
1519
1519
1520
1520
Attaches an event listener to the element. The event type is denoted by the argument. The expression can either be a method name or an inline statement.
1521
1521
1522
+
When used on a normal element, it listens to **native DOM events** only. When used on a custom element component, it also listens to **custom events** emitted on that child component.
1523
+
1522
1524
-**Example:**
1523
1525
1524
1526
```html
@@ -1547,8 +1549,65 @@ type: api
1547
1549
<input@keyup.13="onEnter">
1548
1550
```
1549
1551
1552
+
Listening to custom events on a child component (the handler is called when "my-event" is emitted on the child):
-**See also:**[Methods and Event Handling](/guide/events.html)
1551
1559
1560
+
### v-bind
1561
+
1562
+
-**Shorthand:**`:`
1563
+
1564
+
-**Expects:**`*`
1565
+
1566
+
-**Argument:**`attrOrProp (required)`
1567
+
1568
+
-**Mofifiers:**
1569
+
-`.sync` - make the binding two-way. Only respected for prop bindings.
1570
+
-`.once` - make the binding one-time. Only respected for prop bindings.
1571
+
1572
+
-**Usage:**
1573
+
1574
+
Dynamically bind an attribute or a component prop to an expression.
1575
+
1576
+
When used to bind the `class` or `style` attribute, it supports additional value types such as Array or Objects. See linked guide section below for more details.
1577
+
1578
+
When used for prop binding, the prop must be properly declared in the child component. Prop bindings can specify a different binding type using one of the modifiers.
1579
+
1580
+
-**Example:**
1581
+
1582
+
```html
1583
+
<!-- bind an attribute -->
1584
+
<imgv-bind:src="imageSrc">
1585
+
1586
+
<!-- shorthand -->
1587
+
<img:src="imageSrc">
1588
+
1589
+
<!-- class binding -->
1590
+
<div:class="{ red: isRed }"></div>
1591
+
<div:class="[classA, classB]"></div>
1592
+
1593
+
<!-- style binding -->
1594
+
<div:style="{ fontSize: size + 'px' }"></div>
1595
+
<div:style="[styleObjectA, styleObjectB]"></div>
1596
+
1597
+
<!-- prop binding. "prop" must be declared in my-component. -->
0 commit comments