Moved vue.js app to sub folder

This commit is contained in:
Daniel
2020-03-22 22:19:11 +01:00
parent 84dbb94b5d
commit 73d3352f90
2 changed files with 1 additions and 1 deletions

32
bookshop/app/vue/app.js Normal file
View File

@@ -0,0 +1,32 @@
/* global Vue axios */ //> from vue.html
const GET = (url) => axios.get('/browse'+url)
const books = new Vue ({
el:'#app',
data: {
list: [],
info: '( click on a row to see details... )',
},
methods: {
search: ({target:{value:v}}) => books.fetch (v && '$search='+v),
async fetch (_filter='') {
const columns = 'ID,title,author,price', details = 'genre,currency'
const {data} = await GET(`/Books?$select=${columns}&$expand=${details}&${_filter}`)
books.list = data.value
},
async inspect ({currentTarget:{id}}) {
const {data} = await GET(`/Books/${id}?$select=descr`)
books.info = data.descr
},
}
})
// initilly fill list of books
books.fetch()