0

I've implemented a VUEJS plugin (via CDN) and it works, but I cannot change the default props.. any idea how to change the defaults?

In the code below you can see my attempt to accomplish this

html:

<tags-dic element-id="tags" v-model="selectedTags" :typeahead="true"></tags-input>

<script src="https://cdn.jsdelivr.net/npm/@voerro/[email protected]/dist/voerro-vue-tagsinput.js"></script>

vue/javascript:

<script type="text/javascript">

            var app = new Vue({
                el: '#searchapp',
                components: {  "tags-dic": VoerroTagsInput },

                data: {
                    query: "",
                    typeahead: true,
                    placeholder: 'Add a new tag',
                    limit: 1,
                    onlyExistingTags: true,
                    existingTags: [
                         'DNA',
                         'RNA',
                         'Protein',
                                ],
                    selectedTags: [], 

                },
                methods: {
                    submit: function() {
                        console.log("clicked");
                        if (this.query) {

                            console.log("OK");

                        }
                    }
                }
            })


        </script>

Thanks

3
  • 1
    Changed the name of the question since vue-tagsinput is a component, not a plugin Commented Mar 31, 2019 at 19:36
  • And which default properties are you trying to change? stackoverflow.com/help/mcve Commented Mar 31, 2019 at 19:38
  • attempting to change the props, as seen in the example (e.g. placeholder, typeahead..) Commented Mar 31, 2019 at 19:42

1 Answer 1

1

You can supply your own property values in the template. (See the docs for details.)

<tags-dic 
    element-id="tags" 
    v-model="selectedTags" 
    :typeahead="true"
    :existing-tags="existingTags"
    :placeholder="placeholder"
/>

and so on

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.