vue2-selectize icon indicating copy to clipboard operation
vue2-selectize copied to clipboard

Selectize options are not reactive?

Open plashenkov opened this issue 7 years ago • 8 comments

Currently the component does not react on dynamically updated options. For example, I use localization in my app, and options depend on language strings:

<selectize v-model="userPhone.type">
  <option value="work">{{ lang.user_phone_work }}</option>
  <option value="personal">{{ lang.user_phone_personal }}</option>
</selectize>

This component is located on a page where user can change interface language. Thus, the component should be translated reactively. Currently it keeps previous, non-translated options.

How is it possible to update the component? Maybe there are some methods, hooks, etc? Ideally, if the component will be completely reactive out-of-the-box.

plashenkov avatar Oct 26 '17 13:10 plashenkov

I assume you went with another library. Vue-Select, maybe? Or did you try to make it work with a watcher and the makeOptions method?

Curious how you worked around this.

daverogers avatar Mar 28 '18 19:03 daverogers

Hi @daverogers,

one project still uses this library, vue2-selectize, but I moved another project to https://vue-multiselect.js.org/

I saw Vue-Select too, but Vue-Multiselect seemed more polished to me.

plashenkov avatar Mar 28 '18 19:03 plashenkov

I think vue-multiselect looks like a great option. It seems to be built from the ground up for Vue. Sorry for not helping you guys out with this issue. I've not used Vue in 6-7 months. Good luck!

rhyek avatar Mar 28 '18 23:03 rhyek

Hi @rhyek! What do you use now?

plashenkov avatar Mar 28 '18 23:03 plashenkov

React! I love it.

rhyek avatar Mar 28 '18 23:03 rhyek

That's great. Sorry for the off-topic. You switched because of the necessity or because you like it more than Vue? Could you tell us briefly? In short, what exactly is better in React (for you), in your opinion?

plashenkov avatar Mar 28 '18 23:03 plashenkov

I'm no expert, but basically I switched jobs and they used React. I thought I'd miss Vue, but I now greatly prefer React. Mostly:

  • with JSX you have the full power of javascript and you have more freedom in terms of what you can do
  • there is a large community and very smart people supporting it. there are very well thought out and described best-practices for pretty much anything you want to do. Also, the API is much smaller, but somehow feels more powerful. When I used Vue I used to look at GitHub issues all the time to try and figure out how to do very specific edge-case stuff. Now I mostly use either the official documentation or there is probably a very good article out there covering what I need to do. But even combining those two, I still spend less time trying to figure stuff out vs actually writing code.
  • components are just either functions or classes and they live in native ES6 modules. You just export/import them like any other thing in modern javascript and you can easily pass around references to them and do some pretty interesting stuff. Combine that with styled-components for css-in-js and it is leagues ahead of Vue's single-file-components.
  • integration with TypeScript is top-notch. Vue does not even come close.
  • how it implements the actions-up/data-down paradigm. everything you do in terms of state management/props and their interactions with the render function and other lifecycle hooks makes way more sense to me and is very clean.
  • now that I have ample experience with both React and Vue, it is very clear to me how Vue was just mostly a React spin-off (with other influences as well), and everything just feels patched together in hindsight

rhyek avatar Mar 28 '18 23:03 rhyek

Thank you, very valuable!

plashenkov avatar Mar 29 '18 11:03 plashenkov