Comments (4)
loader.require(["pages/main/home"],function (mod) {
// 有回调的话是每次切换都会触发
mod.init();
})
from buijs-cli.
router.loadPart 是用于局部加载模板,如果有脚本会顺带执行, 相当于 router.load , 只是一个是在当前页的某个id里,一个是新开页面;
loader.require 是加载某个模块, 默认没有回调的话是会缓存, 也就是继续 require, 不会重新请求, 当你有回调的时候, 每次都会执行这个回调, 而这个回调可以拿到你加载模块的上下文的方法, 也就是你的home要return 出 一个init 方法才会有.
这个路由及模块可以实现很多复杂的组合及需求. 具体可以下载案例理解
from buijs-cli.
有供交流的群吗?
from buijs-cli.
具体查看官网的文档吧 www.easybui.com
from buijs-cli.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from buijs-cli.