Slide 21
Slide 21 text
ྫ͑…
• ϑπʔʹॻ͘ͱ
͜Μͳ͔Μ͡?
import Vue, {PropType} from 'vue';
export default Vue.extend({
name: 'TodoForm',
props: {
onSubmit: {
type: Function as PropType<(text: string) => void>,
required: true,
},
},
data() {
return {
text: '',
};
},
computed: {
isValid(): boolean {
return this.text.length > 0;
},
},
methods: {
submit() {
this.onSubmit(this.text);
this.text = '';
},
},
});