• 欢迎浏览“String me = Creater\忠实的资深Linux玩家;”,请文明浏览,理性发言,有侵犯你的权益请邮件我(creater@vip.qq.com).
  • 把任何的失败都当作一次尝试,不要自卑;把所有的成功都想成是一种幸运,不要自傲。
  •    2年前 (2016-08-22)  php |   抢沙发  39 
    文章评分 0 次,平均分 0.0

    1.注册

    <!-- require.js -->
    <script type="text/javascript" src="__STATIC__/js/require.js?__VERSION__"></script>
    <script type="text/javascript">
    	window.UEDITOR_HOME_URL   = '__STATIC__/js/ueditor/';
    	window.UEDITOR_SERVER_URL = '<{:U('Upload/ueditor')}>';
    	require.config({
    		baseUrl: "__STATIC__/module/admin/",
    		urlArgs: '__VERSION__',
    		waitSeconds: 0,
    		paths: {
    			'jquery':                '../../js/jquery.min',
    			'jquery.easyui':         '../../js/easyui/jquery.easyui.min',
    			'jquery.easyui.portal':  '../../js/easyui/plugins/jquery.portal',
    			'jquery.easyui.lang':    '../../js/easyui/locale/easyui-lang-zh_CN',
    			'jquery.easyui.app':     '../../js/jquery.easyui.app',
    			'jquery.venobox':        '../../js/venobox/venobox.min',
    			'jquery.croppic':        '../../js/croppic/croppic',
    			'editor':                '../../js/ueditor/ueditor.require',
    			'editor.zeroclipboard':  '../../js/ueditor/third-party/zeroclipboard/ZeroClipboard.min',
    			'bootstrap':                '../../../statics/album/assets/js/bootstrap.min',
    			'viewer':                '../../../statics/album/dist/viewer',
    			'album':                '../../../statics/album/assets/js/main',
    		},
    		shim: {
    			'jquery.venobox':      {deps: ['jquery']},
    			'jquery.croppic':      {deps: ['jquery']},
    			'jquery.easyui':       {deps: ['jquery']},
    			'jquery.easyui.lang':  {deps: ['jquery', 'jquery.easyui']},
    			'jquery.easyui.portal':{deps: ['jquery', 'jquery.easyui', 'jquery.easyui.lang']},
    			'jquery.easyui.app': {
    				deps: ['jquery', 'jquery.easyui', 'jquery.easyui.portal', 'jquery.easyui.lang', 'jquery.venobox', 'jquery.croppic'],
    				exports: '$'
    			},
    			'editor':              {deps: ['../../js/ueditor/ueditor.config', 'editor.zeroclipboard']},
    			'album':      {deps: ['viewer', 'bootstrap']}
    		}
    	});
    </script>

    2.在需要的地方

    define(['jquery.easyui.app', 'common/event', 'common/method','album'], function($, event, method,album) {
        var module = {
            init: function(e){
                $('.docs-pictures').viewer();
            }
        };
        return module;
    });

    3.写好前端并加入js
    参考文献:http://www.ruanyifeng.com/blog/2012/11/require_js.html

     

    除特别注明外,本站所有文章均为String me = "Creater\忠实的资深Linux玩家";原创,转载请注明出处来自http://unix8.net/home.php/5075.html

    关于

    发表评论

    暂无评论

    切换注册

    登录

    忘记密码 ?

    切换登录

    注册

    扫一扫二维码分享