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