简体   繁体   中英

AMD jQuery Multiselect Widget

I'm trying to use jQuery multi-select widget with AMD and handlebars. Here's the handlebars snippet:

{{#section 'js'}}
  <script type='text/javascript' nonce="{{nonce}}">
    requirejs([
      "domReady",
      "app/ui/js/utils/Chart.min",
      "app/ui/js/utils/jquery.multiselect",
      "app/ui/js/utils/jquery-ui.min",
      "app/ui/js/y",

    ],
    function(wrapper, domReady, x) {
      domReady(function() {
        $.when(wrapper.init()).then(
          function() {
            x.init();
          }
        );
      });
    });
  </script>
{{/section}}

Here are the contents of y.js :

define([
        'jquery',
        'app/ui/rest/x',
        'app/ui/js/utils/errorhandlingutils'
], function( $, restX, errorHandler ) {
    "use strict";
    function _init() {
        //Do something
    }
    return {
        init: function() {

            //Global Init function
            _init();
        }
    };
});

I want to use the multi-select widget in y.js . How should I do that?

我在车把片段中添加了"jquery"作为依赖项来解决此问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM