yuche / vue-strap

Bootstrap components built with Vue.js
http://yuche.github.io/vue-strap/
MIT License
4.71k stars 932 forks source link

I cannot get typeahead async to work #389

Open kirkbushell opened 7 years ago

kirkbushell commented 7 years ago

No errors, no problems. I can get the data option to work absolutely fine, but it never seems to make the request to the server for me to make the selection.

This is my javascript code:

Vue.component('account-new', {
    components: { typeahead },

    data() {
        return {
            "asyncTemplate": '<div>{{ item.name }}</div>',
        };
    },

    methods: {
        callback: function(items) {
            console.log(items);
        }
    }
});

And my HTML...

<typeahead placeholder="Select owner" :template="asyncTemplate" key="items" src="/user?q=" :on-hit="callback"></typeahead>

The callback is never called, and requests are never made - what am I missing?

Would also like to add that if I specify template-name, it results in a partials not defined error.

The docs are seriously lacking on this particular component.

taichunmin commented 7 years ago

Change src="..." to async="..." maybe work.

wffranco commented 7 years ago

in vue1 you need to put a name to the template (use template-name prop).