requirejs

Circular Dependency in Backbone / RequireJS Nested List

≯℡__Kan透↙ 提交于 2019-12-29 05:29:04
问题 I'm setting up a nested categories structure in Backbone with RequireJS. In this structure, a categories collection contains category models, and a single category model can contain a categories collection. Unfortunately this seems to cause the dreaded circular dependencies problem in RequireJS. I have read the docs on RequireJS (http://requirejs.org/docs/api.html#circular) however I am finding the explanation with 'a' and 'b' confusing. Here is my code, which is causing the problem: define([

requireJs 常见错误

走远了吗. 提交于 2019-12-28 21:22:15
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> Unknown custom element: <my-menu-item-model> - did you register the component correctly? For recursive components, make sure to provide the "name" option. vue.js:634 [Vue warn]: Unknown custom element: <myMenuItemModel> - did you r 检查自定义组件名称是否正确 检查components标签是否写对。 来源: oschina 链接: https://my.oschina.net/u/4157150/blog/3149073

requireJS框架 第二节

心已入冬 提交于 2019-12-28 18:47:02
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 目录结构 my-menu-model.js define('my-menu-model',['vue'],function(Vue){ var myMenuModel = Vue.extend({ template:'<h1>this a menu</h1>' }); return myMenuModel; }); config.js require.config({ baseUrl:"lib", paths:{ "vue":"vue", "my-menu-model":"my-menu-model" } }); index.js require(['vue','my-menu-model'],function(vue,myMenuModel){ // //创建组件,并挂在到#app元素上。 new myMenuModel({ el:"#app" }); }); index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script src="lib/require.js" data-main="lib/config.js"></script> <script src=

Use requirejs and jquery, without clobbering global jquery?

末鹿安然 提交于 2019-12-28 04:01:06
问题 I'm using requirejs for the first time on a project. I'm working in an environment that has a lot of Javascript in place already, and I'm looking for clean ways to introduce my own code. The problem I'm having is that I can't seem to find a module of jQuery that I can load that doesn't clobber existing jQuery. I was surprised that even require-jquery.js introduces a global version of jQuery. Is there a way to load jQuery as a module without introducing any globals? 回答1: jQuery 1.7 supports

require is not defined

a 夏天 提交于 2019-12-28 03:42:06
问题 Im building a new React app but get the following error - "require is not defined" hello-world.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>Hello React!</title> <script src="react/react.js"></script> <script src="react/react-dom.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script> </head> <body> <div id="example"></div> <script type="text/babel" src="hello-world.js"> </body> </html> hello-world.js import React from

如何将angularJs项目与requireJs集成

僤鯓⒐⒋嵵緔 提交于 2019-12-28 00:36:27
关于angularjs、requirejs的基础知识请自行学习 一、简单事例的项目目录如下: -index.html -scripts文件夹 --controller文件夹 --- mianController.js --- controller1.js ---controller2.js --directives文件夹 ---mainDirective.js ---directive.js --app.js --router.js --main.js 二、首页 首先你的index.html大概如下 <!doctype html> <!-- <html xmlns:ng="//angularjs.org" id="ng-app" ng-app="webApp"> --> <htmls> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1"> </head> <body><!--其他html内容--> <script type='text/javascript' src='../scripts/lib/require.js' data-main='../scripts/main.js'></script> </body> </html> 在首页index

Requirejs why and when to use shim config

≡放荡痞女 提交于 2019-12-27 18:21:14
问题 I read the requirejs document from here API requirejs.config({ shim: { 'backbone': { //These script dependencies should be loaded before loading //backbone.js deps: ['underscore', 'jquery'], //Once loaded, use the global 'Backbone' as the //module value. exports: 'Backbone' }, 'underscore': { exports: '_' }, 'foo': { deps: ['bar'], exports: 'Foo', init: function (bar) { //Using a function allows you to call noConflict for //libraries that support it, and do other cleanup. //However, plugins

Requirejs why and when to use shim config

最后都变了- 提交于 2019-12-27 18:21:06
问题 I read the requirejs document from here API requirejs.config({ shim: { 'backbone': { //These script dependencies should be loaded before loading //backbone.js deps: ['underscore', 'jquery'], //Once loaded, use the global 'Backbone' as the //module value. exports: 'Backbone' }, 'underscore': { exports: '_' }, 'foo': { deps: ['bar'], exports: 'Foo', init: function (bar) { //Using a function allows you to call noConflict for //libraries that support it, and do other cleanup. //However, plugins

Event handling with subclasses

杀马特。学长 韩版系。学妹 提交于 2019-12-25 10:00:10
问题 Based on this question. I'm moving from RequireJS to browserify (together with babelify) and try to rewrite my current modules to classes. For each of my RequireJS modules I have a method called eventHandler which handles all general module specific events. Now when I extend a class, the parent class calls the subclass`s eventHandler method which leads to invoking the method twice. There's another problem with my current code, though. I've also two methods on several modules to bind and

Event handling with subclasses

风流意气都作罢 提交于 2019-12-25 10:00:08
问题 Based on this question. I'm moving from RequireJS to browserify (together with babelify) and try to rewrite my current modules to classes. For each of my RequireJS modules I have a method called eventHandler which handles all general module specific events. Now when I extend a class, the parent class calls the subclass`s eventHandler method which leads to invoking the method twice. There's another problem with my current code, though. I've also two methods on several modules to bind and