begin error message web component
This commit is contained in:
parent
6a7d540a2c
commit
27825696df
|
@ -16,7 +16,6 @@ router.beforeEach((to, from, next) => {
|
|||
// FROM DEV
|
||||
|
||||
// include vue-custom-element plugin to Vue
|
||||
import { eventBus } from '../../js/event-bus-web-components';
|
||||
|
||||
|
||||
import Text from '../../classes/field-types/text/Text.vue';
|
||||
|
@ -34,13 +33,7 @@ Vue.component('tainacan-selectbox', Selectbox);
|
|||
Vue.component('tainacan-checkbox', Checkbox);
|
||||
Vue.component('tainacan-radio', Radio);
|
||||
Vue.component('tainacan-numeric', Numeric);
|
||||
eventBus.registerComponent( 'tainacan-numeric' );
|
||||
|
||||
|
||||
Vue.component('tainacan-date', Date);
|
||||
eventBus.registerComponent( 'tainacan-date' );
|
||||
|
||||
eventBus.listener();
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
},
|
||||
methods: {
|
||||
changeValue(){
|
||||
// this.$emit('changeValues', { item_id: this.item_id, metadata_id: this.metadata_id, values: this.valueInput } );
|
||||
eventBus.$emit('input', { item_id: this.item_id, metadata_id: this.metadata_id, values: this.valueInput } );
|
||||
this.$emit('changeValues', { item_id: this.item_id, metadata_id: this.metadata_id, values: this.valueInput } );
|
||||
eventBus.$emit('input', { item_id: this.item_id, metadata_id: this.metadata_id, values: this.valueInput, instance: this } );
|
||||
},
|
||||
getValue(){
|
||||
try{
|
||||
|
|
|
@ -23,7 +23,6 @@ export const eventBus = new Vue({
|
|||
const components = this.getAllComponents();
|
||||
for (let eventElement of components){
|
||||
eventElement.addEventListener('changeValues', (event) => {
|
||||
console.log(event,'event')
|
||||
if ( event.detail[0] ){
|
||||
const promisse = this.$store.dispatch('item/updateMetadata', event.detail[0] );
|
||||
promisse.then( response => {
|
||||
|
@ -40,10 +39,11 @@ export const eventBus = new Vue({
|
|||
},
|
||||
updateValue(data){
|
||||
if ( data.item_id ){
|
||||
const promisse = this.$store.dispatch('item/updateMetadata', data );
|
||||
const promisse = this.$store.dispatch('item/updateMetadata',
|
||||
{ item_id: data.item_id, metadata_id: data.metadata_id, values: data.values });
|
||||
promisse.then( response => {
|
||||
eventElement.errorsMsg = JSON.stringify( [] );
|
||||
eventElement.value = response.value;
|
||||
data.instance.message = JSON.stringify( [] );
|
||||
data.instance.value = response.value;
|
||||
}, error => {
|
||||
const metadata = this.errors.find(error => error.metadata_id === data.metadata_id );
|
||||
eventElement.errorsMsg = JSON.stringify( metadata.error );
|
||||
|
@ -64,7 +64,6 @@ export const eventBus = new Vue({
|
|||
const components = [];
|
||||
for( let component of this.componentsTag ){
|
||||
const eventElements = document.getElementsByTagName( component );
|
||||
console.log(eventElements,eventElements.length);
|
||||
if( eventElements ) {
|
||||
for (let eventElement of eventElements){
|
||||
components.push( eventElement );
|
||||
|
|
Loading…
Reference in New Issue