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