replace data with setup/ref

This commit is contained in:
Andreas Zweili 2021-07-30 15:10:09 +02:00
parent 35014b6499
commit 65756e999b
1 changed files with 12 additions and 4 deletions

View File

@ -5,12 +5,20 @@
</template> </template>
<script> <script>
import { ref } from 'vue';
export default { export default {
data() { setup() {
const userName = ref('Foo Bar');
setTimeout(function() {
userName.value = 'baz';
}, 2000);
return { return {
userName: 'Maximilian', userName
}; };
}, }
}; };
</script> </script>
@ -35,4 +43,4 @@ body {
padding: 1rem; padding: 1rem;
text-align: center; text-align: center;
} }
</style> </style>