Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

151
Vistas
Why ClipboardJS can't use in Chrome69 with Vue2 through asynchronous option

I need to copy SQL from the Ajax response, but it seems the clipboard only allows a manual trigger.

It worked in Chrome90+ but doesn't work in Chrome69.

How do you write things to the clipboard in an asynchronous way in Chrome 69?

Here's the button which had opacity at 0:

<button id="SaveSql1" class="tag-read" :data-clipboard-text="sql" @click="copy">don't click me</button>

Here's the button that I click to get info from backend:

<div
    id="SaveSql"
    class="span_css"
    :data-clipboard-text="sql"
    @click.stop="selectSql('save',item)"
    >
      click Me
</div>
    async selectSql(action, item) {
      const params = {
        dbName: item.dbName,
        id: item.id,
        tableName: item.title,
        schemaName: item.schema
      }
      this.dataLoading = true
      try {
        const res = action === 'save' ? await tree.getSaveSql(params) : await tree.getDefaultSql(params)
        this.dataLoading = false
        this.sql = res.data.content
        const button = document.getElementById('SaveSql1')
        button.click()
        } catch (err) {
        this.$message.err(err)
      }
    },
    copy() {
      var clipboard = new Clipboard('.tag-read', () => { return this.sql })
      clipboard.on('success', e => {
        this.$message.success('success copy')
        clipboard.destroy()
      })
      clipboard.on('error', e => {
        this.$message.warning("the browser doesnt't allow copy")
        clipboard.destroy()
      })
    },

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda