4 years ago

One instance for one task or one for all?

Posted 4 years ago by alex_time

All the screencast Jeffrey has made are REALLY great but, I cannot figured out a best practice about two things:

  1. When I have two or more different tasks to approach on the very same page, I would like to have one vue instance for each one, but I have problems when they are nested, my real case is: a page with a h1 title and a form, I have created a simple vue instance to bind the first form field with the h1 title so the vue "namespace" is the entire div containing h1+form+all_inputs; then I have another vue instance on a sub div element containing only two of the inputs which are related one another, but the first vue instance that "contains" the second one have precedence over the vue "child" and the child does not work, also the data property are erased by the first one, how can I solve this?
  2. I have written a couple of different vue instance on different files because I wanted to call theme according to the page that is requested by the user, but how can I load one specific vue js file only on one specific page? I am using elixir and all my scripts are merged together right now.

Please sign in or create an account to participate in this conversation.