mirror of
https://github.com/vuejs/babel-plugin-jsx.git
synced 2025-04-24 02:22:33 +08:00
docs: withModifiers
This commit is contained in:
parent
b817fa38af
commit
84b006bdd3
@ -71,6 +71,24 @@ const App = defineComponent(() => {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```jsx
|
||||||
|
import { withModifiers } from 'vue';
|
||||||
|
|
||||||
|
const App = () => {
|
||||||
|
const count = ref(0);
|
||||||
|
|
||||||
|
const inc = () => {
|
||||||
|
count.value++;
|
||||||
|
};
|
||||||
|
|
||||||
|
return () => (
|
||||||
|
<div onClick={withModifiers(inc, ['self'])}>
|
||||||
|
{count.value}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
Fragment
|
Fragment
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
@ -164,8 +182,8 @@ const App = {
|
|||||||
const App = {
|
const App = {
|
||||||
setup() {
|
setup() {
|
||||||
const slots = {
|
const slots = {
|
||||||
a: () => <div>A</div>,
|
default: () => <div>A</div>,
|
||||||
b: () => <span>B</span>
|
foo: () => <span>B</span>
|
||||||
};
|
};
|
||||||
return () => <A v-slots={slots} />;
|
return () => <A v-slots={slots} />;
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,24 @@ const App = defineComponent(() => {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```jsx
|
||||||
|
import { withModifiers } from 'vue';
|
||||||
|
|
||||||
|
const App = () => {
|
||||||
|
const count = ref(0);
|
||||||
|
|
||||||
|
const inc = () => {
|
||||||
|
count.value++;
|
||||||
|
};
|
||||||
|
|
||||||
|
return () => (
|
||||||
|
<div onClick={withModifiers(inc, ['self'])}>
|
||||||
|
{count.value}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
Fragment
|
Fragment
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
@ -163,8 +181,8 @@ const App = {
|
|||||||
const App = {
|
const App = {
|
||||||
setup() {
|
setup() {
|
||||||
const slots = {
|
const slots = {
|
||||||
a: () => <div>A</div>,
|
default: () => <div>A</div>,
|
||||||
b: () => <span>B</span>
|
foo: () => <span>B</span>
|
||||||
};
|
};
|
||||||
return () => <A v-slots={slots} />;
|
return () => <A v-slots={slots} />;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user