From bbf20b1ca394c023e906f133ffa25b8698c6eded Mon Sep 17 00:00:00 2001 From: D065023 Date: Wed, 9 Feb 2022 10:10:19 +0100 Subject: [PATCH] Change to Vue 3 --- bookshop/app/vue/app.js | 10 +++++----- bookshop/app/vue/index.html | 2 +- reviews/app/vue/app.js | 20 ++++++++++---------- reviews/app/vue/index.html | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/bookshop/app/vue/app.js b/bookshop/app/vue/app.js index 8dbb6cdf..7aaa2972 100644 --- a/bookshop/app/vue/app.js +++ b/bookshop/app/vue/app.js @@ -3,14 +3,14 @@ const $ = sel => document.querySelector(sel) const GET = (url) => axios.get('/browse'+url) const POST = (cmd,data) => axios.post('/browse'+cmd,data) -const books = new Vue ({ +const books = Vue.createApp ({ - el:'#app', - - data: { + data() { + return { list: [], book: undefined, order: { quantity:1, succeeded:'', failed:'' } + } }, methods: { @@ -42,7 +42,7 @@ const books = new Vue ({ } } -}) +}).mount("#app") // initially fill list of books books.fetch() diff --git a/bookshop/app/vue/index.html b/bookshop/app/vue/index.html index 641914ae..6ed2987f 100644 --- a/bookshop/app/vue/index.html +++ b/bookshop/app/vue/index.html @@ -17,7 +17,7 @@
-

{{ document.title }}

+

Capire Books

diff --git a/reviews/app/vue/app.js b/reviews/app/vue/app.js index b46a4892..eab4ea6b 100644 --- a/reviews/app/vue/app.js +++ b/reviews/app/vue/app.js @@ -4,21 +4,21 @@ const GET = (url) => axios.get('/reviews'+url) const PUT = (cmd,data) => axios.patch('/reviews'+cmd,data) const POST = (cmd,data) => axios.post('/reviews'+cmd,data) -const reviews = new Vue ({ +const reviews = Vue.createApp ({ - el:'#app', - - data: { - list: [], - review: undefined, - message: {}, - Ratings: Object.entries({ + data() { + return { + list: [], + review: undefined, + message: {}, + Ratings: Object.entries({ 5 : '★★★★★', 4 : '★★★★', 3 : '★★★', 2 : '★★', 1 : '★', - }).reverse() + }).reverse() + } }, methods: { @@ -66,7 +66,7 @@ const reviews = new Vue ({ datetime: (d) => d && new Date(d).toLocaleString(), }, -}) +}).mount("#app") // initially fill list of my reviews reviews.fetch() diff --git a/reviews/app/vue/index.html b/reviews/app/vue/index.html index a361387f..9ad7771f 100644 --- a/reviews/app/vue/index.html +++ b/reviews/app/vue/index.html @@ -18,7 +18,7 @@
-

{{ document.title }}

+

Capire Reviews