shentao/vue-multiselect

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

Ouverte

#837 ouverte le 3 oct. 2018

 (1 commentaire) (0 réaction) (0 personne assignée)JavaScript (994 forks)batch import
bughelp wanted

Métriques du dépôt

Stars
 (6 559 étoiles)
Métriques de merge PR
 (Métriques PR en attente)

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.

Guide contributeur