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