replace data with setup/ref
This commit is contained in:
parent
35014b6499
commit
65756e999b
|
@ -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>
|
||||
|
|
Reference in New Issue