rewrite it to the composition API
This commit is contained in:
parent
bafece1dba
commit
5e54aa06de
|
@ -4,12 +4,17 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { computed } from 'vue';
|
||||
export default {
|
||||
props: ['firstName', 'lastName', 'age'],
|
||||
computed: {
|
||||
userName() {
|
||||
return this.firstName + ' ' + this.lastName;
|
||||
}
|
||||
setup(props) {
|
||||
const userName = computed(function() {
|
||||
return props.firstName + ' ' + props.lastName;
|
||||
});
|
||||
|
||||
return {
|
||||
userName
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
Reference in New Issue