Getting everything ready for you…

Loading courses, problems and your progress. This takes just a moment.

0s

Vue.js Cheat Sheet

Reactivity

const n = ref(0);          // n.value in script
const o = reactive({});
const c = computed(() => n.value * 2);
watch(n, (v) => {});
onMounted(() => {});

Template

{{ value }}
<p v-if="a"></p> <p v-else></p>
<li v-for="x in list" :key="x.id"></li>
<input v-model="name" />
<a :href="url" @click="go"></a>
<form @submit.prevent="send"></form>

Components

const props = defineProps({ title: String });
const emit = defineEmits(['save']);
emit('save', data);

Full Vue.js documentation