shentao/vue-multiselect

noResult emit close and open in all vue multiselect in a component

Aberta

#837 aberto em 3 de out. de 2018

 (1 comentário) (0 reação) (0 responsável)JavaScript (994 forks)batch import
bughelp wanted

Métricas do repositório

Stars
 (6.559 estrelas)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

Steps to reproduce

I have a componente with vue multiselect with this code in noResult:

      <span v-if="permiteCriarNovo" slot="noResult" style="display:flex; justify-content:space-between">
        <span><i style="color:#A9A9A9"> {{pesquisa}}</i></span>
        <a sytle="text-align: right" href="javascript: void(0)" @click.stop="criarCadastro">Criar</a>          
      </span>

  criarCadastro() {        <-- methods criar
    if (!this.modalCadastro) {        
      this.servico
          .cadastra(JSON.parse('{"'+this.campoNome+'":"'+this.pesquisa+'"}'))
          .then(response =>{
              response.json().then((documento) => {
                this.opcoes.push(documento.data)                                 
                this.$notify({
                  group: 'salvar',
                  title: 'Sucesso',
                  type: 'success',
                  text: this.caption+' salva com sucesso.',
                  duration: 2000
                });                 
              })
          }, err => {
              console.log('Não foi possível cadastrar o elemento')
          });
    }
    else {
        this.$emit('mostralModal',this.pesquisa)
    }
    
  }

When i click in Criar emits a open and close event in all vue-multiselect in the component.

Expected behaviour

Emit the event only in the component I click.

Guia do colaborador