vue项目中引入支付宝支付

<template>
    <div id="AliPay" v-html ="apply">
       loading
    </div>
</template>

<script lang="ts">
import { Component,Vue,Watch,Prop } from 'vue-property-decorator'
import api_web from "../../../api/api_web";

@Component({
  components: {

  }
})
export default class AliPay extends Vue{
   public apply:string="";
   /**
     * 订单id
     */
    id:string="";

    created () {
        this.id = this.$route.query.id;
    }
    mounted() {
        $('#AliPay').hide();
        api_web.getAliPay(this.id).then((res)=>{
            // console.log(res);
            this.apply = res.body;
            this.$nextTick(()=>{
                document.forms[0].submit()
            })
        });
    }
}
</script>

<style lang="scss" scoped>

</style>

你可能感兴趣的:(vue)