javascript - 什么是模块化编程
PHP中文网
PHP中文网 2017-04-10 14:35:03
0
2
442

假如我有a.html,b.html,

a有日历选择、编辑器功能,需要引入datepicker,kindeditor,
b有日历选择、弹层功能,需要引入datepicker,layer,但是这个页面的日历配置和a.html不一样,(a.html的日历没限制,b.html的日历有时间范围限制)

我用requireJS的话,怎么模块化这种情况?

PHP中文网
PHP中文网

认证0级讲师

reply all(2)
左手右手慢动作

定义三个功能模块,
datepicker,kindeditor,layer

两个业务模块
a 依赖:[datepicker,kindeditor]
b 依赖:[datepicker,layer]

怎么组装在a和b里面

左手右手慢动作

日历,编辑器,弹层应该都属于功能组件,本就应该做独立封装或模块化,至于日历配置不一样只要在初始化日历组件时加以区分就可以了吧。

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template