yuche / vue-strap

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

clear-button is not working #460

Open duanzonglong opened 7 years ago

duanzonglong commented 7 years ago

v-select When I clicked the clearButton. But it's not working.I test it in firefox and google.

karlerss commented 6 years ago

Having the same problem in firefox.

Seems to be related to this: https://stackoverflow.com/questions/14689879/span-inside-button-is-not-clickable-in-ff.

Just move the clear button outside of the button. After importing, monkey patch it. I did mine like this:

import {select} from 'vue-strap';
select.template = select.template.replace(/<span v-if="clearButto.*?\/span>/, '');
select.template = select.template.replace(/class="btn-content"/, 'class="btn-content" style="padding-right: 15px"');
select.template = select.template.replace(/<\/button>/, '</button><span v-if="clearButton&amp;&amp;values.length" class="close" @click.prevent="clear()" ' +
    ' style="position: absolute; top: 10px; right: 24px;">×</span>');
Vue.component('v-select', select);