E
E
Eugene Wolf2019-03-21 04:08:10
Vue.js
Eugene Wolf, 2019-03-21 04:08:10

Which "models" package for VueJS should I choose?

Good day colleagues!
Please recommend, from your experience, some sensible library for working with models for VueJS. The essence of the problem, in short:
1. I tried to work without third-party libraries (models) in general - the result is an awful lot of monotonous, little readable code.
2. I tried http://vuemc.io - it looks good, but in reality it turned out that everything is not as good as it seems. For example, the event "save.success" - I did not manage to catch (perhaps I caught it badly), I did not find events (or "hooks") of the "beforeSave" format at all (perhaps I also searched badly?), By default, only 1st level attributes, i.e. arrays (nested elements) are not saved and how to fix it, I did not find the answer in the documentation, unfortunately.
PS We kindly ask you to indicate not the first links you came across from the search engine, but solutions that you personally encountered and which, at a minimum, allow you to load / save / process fields with deep nesting (i.e. arrays, arrays of objects, etc.), with full support for events such as load/save and full handling of results and errors (load/save). Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Spunreal, 2019-03-21
@Spunreal

I work with vuex-orm
So far I haven't noticed any serious problems.

D
Denis Labutin, 2019-03-21
@lazy_den

I am using vue mc.
To make nested objects, you need to use mutations

mutations() {
    return {
      id: (id) => String(id) || null,
      serial: Number,
      date: String,
      salary: Number,
      status: Number,
            supplies: (supplies) => {
        if(Array.isArray(supplies)){
          return new SupplyCollection(supplies)
        }else if(supplies instanceof SupplyCollection){
          return supplies;
        }
        return new SupplyCollection();
      },
      materials: (materials) => {
        if(Array.isArray(materials)){
          return new MaterialCollection(materials)
        }else if(materials instanceof MaterialCollection){
          return materials;
        }
        return new MaterialCollection();
      },

        }
  }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question