41 lines
992 B
JavaScript
41 lines
992 B
JavaScript
(function () {
|
|
class Indexe {
|
|
config = {
|
|
el: '.bj',
|
|
Popswitch: false,
|
|
title: "标题",
|
|
title2: "内容"
|
|
}
|
|
|
|
constructor(el, ope) {/*检测*/
|
|
if (typeof el != "string" || el.length == 0 || document.querySelector(el) == null) {
|
|
throw new Error("el参数未传");
|
|
} else {
|
|
console.log("通过检测")
|
|
}
|
|
this.config.el = el;
|
|
this.config.Popswitch = ope.Popswitch || this.config.Popswitch;
|
|
this.config.title = ope.title || this.config.title;
|
|
|
|
console.log(this.config)
|
|
this.tianjia()
|
|
}
|
|
|
|
tianjia() {
|
|
this.el.innerHTML = `<div></div>`
|
|
}
|
|
|
|
$(className) {
|
|
return document.querySelector(className);
|
|
}
|
|
}
|
|
|
|
window.Indexe = Indexe
|
|
|
|
})()
|
|
//1.检测内容
|
|
//2.向html上追加内容
|
|
//3.追加的内容等于用户自定义的内容
|
|
|
|
|