19 lines
323 B
JavaScript
19 lines
323 B
JavaScript
|
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");
|