salix-front/test/jest/__tests__/demo/MyButton.vue

31 lines
580 B
Vue
Raw Normal View History

2022-03-24 12:41:17 +00:00
<script>
import { defineComponent, ref } from 'vue';
export default defineComponent({
name: 'MyButton',
props: {
incrementStep: {
type: Number,
default: 1,
},
},
setup(props) {
const counter = ref(0);
const input = ref('rocket muffin');
function increment() {
counter.value += props.incrementStep;
}
return { counter, input, increment };
},
});
</script>
<template>
<div>
<p class="content">{{ input }}</p>
<span>{{ counter }}</span>
<q-btn class="button" @click="increment()"></q-btn>
</div>
</template>