<template>
  <view>
    <button style="cursor: pointer;display:none;" :class="triggerName" :data-clipboard-text="alipayLink">
    </button>
    <!-- 支付宝支付界面 -->
    <u-modal :show="show" title="支付宝支付" @confirm="handleConfirm">
      <view class="slot-content">
        链接已复制，请到外部浏览器完成支付
      </view>
    </u-modal>
  </view>
</template>

<script>
  import Clipboard from 'clipboard'
  export default {
    name: 'AlipayLinkCopy',
    props: {
      alipayLink: {
        type: String,
        default: ''
      },
      show: {
        type: Boolean,
        default: false
      },
      triggerName: {
        type: String,
        default: 'clipboard'
      }
    },
    data() {
      return {

      }
    },
    mounted() {
      new Clipboard('.clipboard')
    },
    methods: {
      handleConfirm() {
        this.$emit('update:show', false)
        this.$emit('confirm')
      }
    }
  }
</script>

<style>
</style>
