This repository has been archived on 2021-09-06. You can view files and clone it, but cannot push or open issues or pull requests.
2021-09-04 14:47:16 +02:00
|
|
|
<template>
|
|
|
|
<h2>{{ userName }}</h2>
|
|
|
|
<h3>{{ age }}</h3>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-09-04 15:18:04 +02:00
|
|
|
import { computed, inject } from 'vue';
|
2021-09-04 14:47:16 +02:00
|
|
|
export default {
|
2021-09-04 15:18:04 +02:00
|
|
|
props: ['firstName', 'lastName'],
|
2021-09-04 14:51:44 +02:00
|
|
|
setup(props) {
|
|
|
|
const userName = computed(function() {
|
|
|
|
return props.firstName + ' ' + props.lastName;
|
|
|
|
});
|
|
|
|
|
2021-09-04 15:18:04 +02:00
|
|
|
const age = inject('user-age');
|
|
|
|
|
2021-09-04 14:51:44 +02:00
|
|
|
return {
|
2021-09-04 15:18:04 +02:00
|
|
|
userName,
|
|
|
|
age
|
2021-09-04 14:51:44 +02:00
|
|
|
};
|
2021-09-04 14:47:16 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style></style>
|