vue单引js写组件的总结
2021-03-18 19:25
标签:spl 逻辑 html class this let rap 调用 play html部分正常写 调用组件时 JS部分 vue单引js写组件的总结 标签:spl 逻辑 html class this let rap 调用 play 原文地址:https://www.cnblogs.com/yangsg/p/12766636.html//写在body里面
//template 要写在body外面
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();
})
上一篇:js中!和!!的区别及用法
下一篇:(HRNet):Deep High-Resolution Representation Learning for Visual Recognition相关论文