Magento configurable.js - what does separatorIndex do?
Magento configurable.js - what does separatorIndex do?
我想知道下面的代码是怎么做的,因为我在类别列表视图中的自定义可配置选择器+AJAX预览中遇到了问题。
var separatorIndex = window.location.href.indexOf('#');
if (separatorIndex != -1) {
var paramsStr = window.location.href.substr(separatorIndex+1);
var urlValues = paramsStr.toQueryParams();
if (!this.values) {
this.values = {};
}
for (var i in urlValues) {
this.values[i] = urlValues[i];
}
}
我得到的错误是Uncaught TypeError: Cannot read property 'config' of undefined
只有当我在URL(分层导航)中有散列时才会发生这种情况。
var separatorIndex = window.location.href.indexOf('#'); // Looks for index of # in url
if (separatorIndex != -1) { // If # exists and index is set
var paramsStr = window.location.href.substr(separatorIndex+1); // Get everything after the # in url
var urlValues = paramsStr.toQueryParams(); // Transform to key value
if (!this.values) { // Don't know where this comes from?
this.values = {};
}
for (var i in urlValues) {
this.values[i] = urlValues[i]; // Fill up the this.values with values from the substring after #
}
}
相关文章:
- 附加到原型属性的Do函数没有闭包
- What does requirejs.config() do?
- 什么是"!函数(){}〃;javascript中的mean/do
- 使用谷歌地图Do’s Donot’s
- CoffeeScript do,传递参数
- What does .equals() do?
- Do JS Reference Errors停止运行时线程执行
- Do let语句在全局对象上创建属性
- 什么是“;无效切片大小”;轨道错误?-@categories.ech_slice(column_length)do|co
- do/while语句中的if-elseif语句无限循环javascript
- How to do "HTML FORM action=location.replace('nextp
- Do变量声明初始化函数
- Javascript do/while循环显示意外结果
- 正面或反面游戏javascript do/while循环
- What does connect.facebook.net/en_US/all.js do
- Magento configurable.js - what does separatorIndex do?
- 简单的 do/while 循环无限循环问题
- Do __proto__ 和 Object.getPrototype 的公开完全相同的功能
- JavaScript 中 do-while 循环的用例
- switch 语句在 do while JavaScript 中