javascript - dojo/_base包有什么作用?
打开dojo的API,点击dojo跳转的第一个链接就是这个dojo/_base/kernel,页面上有很多属性描述,譬如:baseUrl
。我本来想在控制台输出下 baseUrl
看看是什么内容的。但是代码报错。(API中描述的,baseUrl
Defined by: dojo/_base/configSpidermonkey
)
想了解下dojo/_base
的作用和它下面的属性和方法的使用方式?谢谢!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test _base kernel</title>
</head>
<body>
<h1 id="greeting">Hello</h1>
<script>
var dojoConfig = {
async: true
};
</script>
<script type="text/javascript" src="../dojo/dojo.js"></script>
<script type="text/javascript">
//错误
/*require(['../dojo/_base/kernel.js'], function(kernel){
var currentLocale = kernel.locale;
console.log("currentLocale: ", currentLocale);
});*/
require(['dojo/_base/kernel'], function(kernel){
var currentLocale = kernel.locale;
console.log("currentLocale: ", currentLocale);
});
require([], function(){
console.log("Hello, dojo!");
});
require(['dojo/_base/configSpidermonkey'], function(dojo1){
console.log("dojo: ", dojo1.baseUrl);
});
</script>
</body>
</html>