Giter Site home page Giter Site logo

Comments (5)

chrisvfritz avatar chrisvfritz commented on May 7, 2024

I do include one simple implementation in login.vue. Is that the kind of thing you're looking for?

from vue-enterprise-boilerplate.

jnarowski avatar jnarowski commented on May 7, 2024

I was talking about a more robust way to handle form data through vuex. There are some solutions out there but not sure any of them are active. I might start my own OS project for it.

Even without a plugin, when forms get complex (aka using many nested components) validation gets tricky, storing the data in the parent component state also gets tough.

This is one thing that most boilerplates miss is showing real, complex forms (often partially populated via ajax etc).

I just refactored a form into vuex that ended up being about 5-10 components and is quite complex so I just recently felt this pain.

It seems that there isn't many examples of this kind of thing using vuex online. I'd love to help contribute to it in some way if you're interested in adding something like this (even as a non working example) to the boilerplate.

I do see a strong potential for developing a lightweight, robust form handling library built on vuex that handles validation and form data gathering (into a temporary forms[this.form.name] endpoint on vuex.

What do you think?

from vue-enterprise-boilerplate.

chrisvfritz avatar chrisvfritz commented on May 7, 2024

There are definitely some patterns that can help with complex forms, but I've usually found the exact needs and nature of the complexity can vary a lot between projects, so there's not really a 1-size-fits-all solution that I can recommend unfortunately.

In the case of forms built out of many nested components, I often see people break up a form component into many smaller, nested components just because the original form component was getting big. There isn't really anything wrong with a big component though. As long as it's not becoming a pain to maintain, it can stay big. I've seen people create a lot of work for themselves by splitting up a single concern into many deeply coupled components that have to constantly communicate. It's sort of like a recipe with 20 ingredients - it might seem like a lot, but introducing 20 chefs to "simplify" it will just make it 20 times more complex. 😄

I'm not sure if that's at all relevant to your case though. It's difficult to give advice without the code and like I said, there isn't really a pattern that's appropriate for everyone. For that reason, I don't think it meets the requirements to be added to the boilerplate unfortunately.

from vue-enterprise-boilerplate.

jnarowski avatar jnarowski commented on May 7, 2024

That is an interesting point. So do you generally keep forms in a single component even if they might be hundreds to thousands of lines long, with sub collection modification etc?

I can see an argument to be made to perhaps only create components for input level stuff within a form, keeping it one to two levels deep instead of more.

from vue-enterprise-boilerplate.

chrisvfritz avatar chrisvfritz commented on May 7, 2024

I'll keep a component long if I feel its complexity is still pretty low and so not very difficult to maintain - and there are also other ways to shorten form components other than splitting them out into subcomponents. For example, render functions can be pretty useful in creating dynamic form generators, sometimes even automatically by analyzing the data that it's binding to.

from vue-enterprise-boilerplate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.