Skip to content
This repository was archived by the owner on Mar 30, 2019. It is now read-only.

Commit bdffc55

Browse files
author
Gilvan
committed
metódos on, off e emit no plugin do genesis
1 parent 129fd73 commit bdffc55

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

components/crud/Index.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@
1919
styles: {
2020
default: () => ({})
2121
}
22+
},
23+
methods: {
24+
enviroment () {
25+
console.log('~> arguments', arguments)
26+
}
27+
},
28+
created () {
29+
this.$g.on('app-crud-enviroment', this.enviroment())
30+
},
31+
destroyed () {
32+
this.$g.off('app-crud-enviroment')
2233
}
2334
}
2435
</script>

components/crud/model/form/MixinForm.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ export default {
186186
this.readonly = this.scopes[this.scope].readonly
187187
}
188188
this.renderAll()
189+
if (this.tabs.length) {
190+
this.$g.emit('app-crud-enviroment', 'tabs')
191+
}
192+
if (this.steps.length) {
193+
this.$g.emit('app-crud-enviroment', 'steps')
194+
}
189195
},
190196
mounted () {
191197
if (this.id && this.$route.params[this.id]) {

plugin/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Events } from 'quasar-framework'
12
import { get, set } from 'lodash'
23
import { uniqid } from 'genesis/support/utils'
34
import router from 'genesis/infra/router'
@@ -28,8 +29,12 @@ const browse = (path, query = {}, changer = '~') => {
2829
window.setTimeout(() => router.push({path, query}), 100)
2930
}
3031

32+
const on = (name, callback) => Events.$on(name, callback)
33+
const off = (name) => Events.$off(name)
34+
const emit = (name, parameters) => Events.$emit(name, parameters)
35+
3136
const genesis = {
32-
get, set, browse
37+
get, set, browse, on, off, emit
3338
}
3439

3540
/**

0 commit comments

Comments
 (0)