- starting add Categories
- improved layout drawer
This commit is contained in:
3
src/components/categories/category/category.scss
Normal file
3
src/components/categories/category/category.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
.mycard {
|
||||
visibility: hidden;
|
||||
}
|
||||
62
src/components/categories/category/category.ts
Normal file
62
src/components/categories/category/category.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import Vue from 'vue'
|
||||
import { Component } from 'vue-property-decorator'
|
||||
import { GlobalStore } from '@store'
|
||||
|
||||
import VueIdb from 'vue-idb'
|
||||
|
||||
Vue.use(VueIdb)
|
||||
|
||||
require('./category.scss')
|
||||
|
||||
@Component({})
|
||||
export default class Category extends Vue {
|
||||
idb = null
|
||||
category: string = ''
|
||||
$t: any
|
||||
|
||||
created() {
|
||||
this.createdb()
|
||||
|
||||
this.caricaCat()
|
||||
}
|
||||
|
||||
createdb() {
|
||||
// Inserisci la Categoria nel DB
|
||||
this.idb = new VueIdb({
|
||||
version: 1,
|
||||
database: 'test',
|
||||
schemas: [
|
||||
{ categories: '++id, sub_categ_id, descr_it' }
|
||||
]
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
caricaCat() {
|
||||
let mythis = this
|
||||
this.idb.open().then(function () {
|
||||
|
||||
return mythis.idb.categories
|
||||
.toArray()
|
||||
|
||||
}).then(function () {
|
||||
|
||||
console.log('FINE LOAD')
|
||||
})
|
||||
}
|
||||
|
||||
insertCategory(): any {
|
||||
let mythis = this
|
||||
|
||||
this.idb.open().then(function () {
|
||||
console.log('Inserisci Cat: ', mythis.category)
|
||||
return mythis.idb.categories.add({ descr_it: mythis.category })
|
||||
|
||||
}).then(function () {
|
||||
|
||||
console.log('FINE')
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
16
src/components/categories/category/category.vue
Normal file
16
src/components/categories/category/category.vue
Normal file
@@ -0,0 +1,16 @@
|
||||
<template>
|
||||
<q-page>
|
||||
<div class="panel">
|
||||
<p class="caption">Category:</p>
|
||||
|
||||
<q-input v-model="category" inverted float-label="Inserisci la Categoria"
|
||||
:after="[{icon: 'arrow_forward', content: true, handler () {}}]"
|
||||
v-on:keyup.enter="insertCategory"/>
|
||||
|
||||
</div>
|
||||
</q-page>
|
||||
|
||||
|
||||
</template>
|
||||
<script lang="ts" src="./category.ts">
|
||||
</script>
|
||||
Reference in New Issue
Block a user