|
const app = Vue.createApp({
|
|
data: () => ({
|
|
newItem: "",
|
|
items: ["buy milk"],
|
|
}),
|
|
methods: {
|
|
addItem() {
|
|
if (!this.newItem) return;
|
|
this.items.unshift(this.newItem);
|
|
this.newItem = "";
|
|
},
|
|
removeItem(index) {
|
|
this.items.splice(index, 1);
|
|
},
|
|
},
|
|
});
|
|
|
|
app.mount("#comp");
|