vue-cool-select icon indicating copy to clipboard operation
vue-cool-select copied to clipboard

Feature/extensibility

Open opichon opened this issue 5 years ago • 1 comments

Added a getItems computed property. As a default, it returns the items prop. However, it allows greater latitude in extending the component that I believe was not possible previously. The rationale is as follows: Iwas trying to extend the component to make a country picker. To do that, I had to "fix" the items prop by passing a list of countries. That works, sort of (actually, only by overriding the prop with a default value, so it's not quite perfect). But when trying to introduce support for i18n, then I couldn't find a way to make it work. I would have had to mutate the prop, which is not possiblein vue.js.

With this fix, I can simply override the getItems computed method. The items prop can be overridden as 'not required', and ignored if supplied.

opichon avatar May 31 '19 14:05 opichon

Hi, thanks for the PR, but I need to clarify something so that I am sure that these changes are necessary.

I don’t quite understand why you need a getItems method that just returns the item prop. How will you use it in your code? Sample code did not interfere was.

actually, only by overriding the prop with a default value, so it's not quite perfect

I do not quite understand why you are rewriting the prop and what is the "default value"

But when trying to introduce support for i18n, then I couldn't find a way to make it work. I would have had to mutate the prop, which is not possiblein vue.js.

I do not quite understand what problem you are facing. Maybe I have a solution for this.

With this fix, I can simply override the getItems computed method

Not sure if this is a good solution for component extensibility.

The items prop can be overridden as 'not required', and ignored if supplied.

So you don't even want to give items prop? And just write your method getItems?

If you explain what the problem really is, then I can help. I think you are doing something wrong and possibly violating the philosophy of Vue.

iliyaZelenko avatar Jun 01 '19 13:06 iliyaZelenko