I want to open the bottom-sheet after the selection process in mobile. I used touchstart eventListener for my paragraph but it doesn't work correctly with selection . After making a selection, I have to click again.
methods:{
selectWord() {
const selection = window.getSelection();
this.slctdWrd = selection.toString().trim();
if (this.slctdWrd.length > 2) {
this.openBottomSheet();
}
},
}
mounted() {
this.$refs.paragraph.addEventListener('touchstart', this.selectWord, false);
},
beforeDestroy() {
this.$refs.paragraph.removeEventListener('touchstart',this.selectWord, false);
},
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>