babel-plugin-jsx/example/index.js

41 lines
687 B
JavaScript
Raw Normal View History

2020-05-13 19:14:28 +08:00
import { createApp, ref, defineComponent } from 'vue';
const SuperButton = (props, context) => (
<div class={props.class}>
Super
<button
on={{
click: () => {
context.emit('click');
},
}}
>
{ props.buttonText }
</button>
</div>
);
SuperButton.inheritAttrs = false;
const App = defineComponent(() => {
const count = ref(0);
const inc = () => {
count.value++;
};
return () => (
2020-05-17 16:36:38 +08:00
<>
2020-05-13 19:14:28 +08:00
Foo {count.value}
<SuperButton
buttonText="VueComponent"
class="xxx"
on={{
click: inc,
}}
/>
2020-05-17 16:36:38 +08:00
</>
2020-05-13 19:14:28 +08:00
);
});
createApp(App).mount('#app');