Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Ref focus then it can not suggest #591

Open
2 of 9 tasks
greeenSY opened this issue Sep 25, 2023 · 0 comments
Open
2 of 9 tasks

Use Ref focus then it can not suggest #591

greeenSY opened this issue Sep 25, 2023 · 0 comments

Comments

@greeenSY
Copy link

I'm submitting a ...

  • bug report
  • feature request
  • support request

What is the current behavior?

I emit a focus event, then it errors when suggest.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

<template>
   <vue-simple-suggest
              v-if="emailInputVisible"
              ref="emailInput"
              type="text"
              size="small"
              v-model="emailInputValue"
              :list="suggestedEmailList"
              :style="{ width: '240px', height: '25px', marginRight: '8px', display: 'inline-block' }"
              autocomplete="off"
              :filter-by-query="true"
          >
          </vue-simple-suggest>
          <a-tag v-else style="background: #fff; borderStyle: dashed;" @click="showEmailInput">
            <a-icon type="plus"/>
          </a-tag>
</template>

<script>
export default {
  //...
  
  data() {
    emailInputValue: '',
    suggestedEmailList: []
  }
  methods: {
    showEmailInput() {
      this.emailInputVisible = true
      this.$nextTick(function () {
         this.$refs.emailInput.$el.querySelector('input').focus() // it encountered this error?
      })
    },
  }
  //...
}
</script>

What is the expected behavior?

How are you importing Vue-simple-suggest?

  • ESNext (original code, single-file .vue component, css included) (import VueSimpleSuggest from 'vue-simple-suggest/lib')
  • ES6 (import VueSimpleSuggest from 'vue-simple-suggest')
  • ES7 and above (import VueSimpleSuggest from 'vue-simple-suggest/dist/es7')
  • Bundled version (import VueSimpleSuggest from 'vue-simple-suggest')
  • CommonJS (const VueSimpleSuggest = require('vue-simple-suggest'))
  • UMD Component (<script type="text/javascript" src="https://unpkg.com/vue-simple-suggest"></script>)

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • Vue.js Version: 2.6.10
  • Vue-simple-suggest version: 1.11.2
  • Browser: Chrome
  • Language: ES6
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant