html部分正常写 调用组件时

//写在body里面
<withdrawal-hongbao v-if="flagHongbao" :hongbao="hongbao"></withdrawal-hongbao>

//template 要写在body外面

<template >
    <div >
        <div class="hongbao-con">
            <div ></div>
            <div ></div>
        </div>
    </div>
</template>

JS部分

class Withdrawal {
  constructor() {
    this.init();
  }
  init() {
        let components = this.vueComponents();

        this.$vm = new Vue({
            el: ".wrapper",
            data: {
                   hongbao:{
                      url:"",    
                      sumAmt:"",    
                },
                flagHongbao:false,
               },
            methods: {
                hongBao: function() {//你的逻辑}     
            },
            components: components,
            })
  vueComponents() {
    let self = this;
return { withdrawalHongbao:self.getwithdrawalhongbao() }; } getwithdrawalhongbao(){ return Vue.extend({ template: "#withdrawal_hongbao", props: ["hongbao","flagHongbao"], methods:{ goClose(){ this.flagHongbao = false; document.getElementById("hongbao-main").style.display = "none"; }, goUrl(){} } }); } } $(function() { new Withdrawal(); })


  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
  • 2021-11-09
  • 2022-01-27
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-04
  • 2022-12-23
  • 2021-11-21
  • 2021-06-10
  • 2021-09-20
  • 2022-12-23
相关资源
相似解决方案