vue页面和js分离
将vue中需要拆分的代码copy到你创建的JS页面(假设为SevenRoomMethodSprit.js)中,class SevenRoomMethodSprit {// eslint-disable-next-line no-useless-constructorconstructor () {}static getInstance () {if (!this...
·
将vue中需要拆分的代码copy到你创建的JS页面(假设为SevenRoomMethodSprit.js)中,
class SevenRoomMethodSprit {
// eslint-disable-next-line no-useless-constructor
constructor () {
}
static getInstance () {
if (!this.instance) {
this.instance = new SevenRoomMethodSprit()
}
return this.instance
}
// 封装之后的方法
getEpool (equipmentConfig, that) {
// 需要封装的代码
}
export default SevenRoomMethodSprit
调用:
1.创建对象
let sevenRoomMethodSprit = new SevenRoomMethodSprit();
2.调用方法
SevenRoomMethodSprit.getEpool(that.equipmentConfig,that);
更多推荐
已为社区贡献5条内容
所有评论(0)