加载主干的requirejs文件时出现此错误.我尝试加载r.js,requirejs优化器,但我仍然坚持使用它.
Uncaught Error: Mismatched anonymous define() module: function definition(name, global){
"use strict";
var PubSub = {
name: 'PubSubJS',
version: '1.3.1-dev'
Run Code Online (Sandbox Code Playgroud)
以下是我的js:
define([
'jquery',
'underscore',
'backbone'
],function(){
subAccountRouter = Backbone.Router.extend({
routes: {
// Defining the routes
'sub-accounts': 'subAccountList',
'*actions': 'defaultAction'
},
});
Run Code Online (Sandbox Code Playgroud)
似乎已经对requirejs define()调用函数进行了一些更改,不知何故无法弄清楚它.有没有人有想法?
编辑:::
下面是router.js文件.
define([
'jquery',
'underscore',
'backbone'
],function($, _, Backbone){
SubAccountRouter = Backbone.Router.extend({
routes: {
'sub-accounts': 'subAccountList',
'*actions': 'defaultAction'
},
initialize: function () {
this.appContainer = $("#subaccount");
//collections and models
this.subAccountCollection = null;
this.subAccountModel = null;
},
subAccountList: …Run Code Online (Sandbox Code Playgroud) I'm trying to save certain data into cookies, in such a way that if I jump from one page to another, the data entered should be saved and retrieved back on refresh. I have a link:
<div class="esc-policy">
<a href="#">New Link</a>
</div>
Run Code Online (Sandbox Code Playgroud)
before i fire the click event i need to save the entered the following data fields:
<table class="form">
<tr>
<td class="label">
<label>Name*</label>
<input id="nameInput" type="text" maxlength="100"/>
</td>
<td class="label">
<label>Description</label>
<input id="descriptionInput" type="text" maxlength="200" >
</td>
</tr>
</table> …Run Code Online (Sandbox Code Playgroud) 我想使用 css 删除最后一个孩子的右边框。我正在使用下面的 html:
<div class="dividers">
<div class="clone_container">
<img src="clone.png"/>
<a class="button-link">Clone</a>
</div>
<div class="delete">
<img src="delete.png"/>
<a class="button-link">Delete</a>
</div>
<div class="abort">
<img src="abort.png"/>
<a class="button-link">Abort</a>
</div>
<div class="pause">
<img src="pause.png"/>
<a class="button-link">Pause</a>
</div>
</div> //end of dividers div
Run Code Online (Sandbox Code Playgroud)
和CSS:
div.dividers a {
display: inline-block;
border-right: 1px solid #DCDCDC;
border-radius: 4px;
height: 22px;
}
div.dividers {
margin-right: -3px;
padding-right: 0px
}
div.dividers a:last-child { border-right: none; }
Run Code Online (Sandbox Code Playgroud)
当我执行{ border-right: none; }如上所示的操作时,所有边框都会被删除。我怎样才能解决这个问题?有什么想法的人吗?
我正在寻找的输出是:克隆 | 删除 | 中止 | 暂停
我在桌面上有一个Name和Status字段,我想显示Status字段的值Active和Inactive.这是我正在使用的模板:
<tbody>
<% _.each(accountLists, function(account) { if (account.active == 'true') ? 'Active': 'Inactive'%>
<tr>
<td><%= account.active %></td>
</tr>
<% }) %>
</tbody>
Run Code Online (Sandbox Code Playgroud)
当我运行时,模板抛出:
Uncaught SyntaxError: Unexpected token
Run Code Online (Sandbox Code Playgroud)
为什么?
作为参考,下面是我的accountView.js
var AccountList = Backbone.View.extend({
initialize: function(){
},
el:'#sub-account-list',
render: function(id){
var self = this;
var accountList = new SubAccountCollection([],{ id: id });
accountList.fetch({
success: function(accountLists){
var data = accountLists.toJSON();
var accounts = data[0].data.items;
var template = $("#sub-account-list").html(_.template(tmpl, {accounts:accounts}));
},
});
}
});
Run Code Online (Sandbox Code Playgroud)