1

だから私はjspmを使ってaureliaをセットアップしています。Bootstrap 4 を次のようにインストールしました。

jspm install npm:bootstrap@4.0.0-alpha.2

次に、main.js で次のことを行いました。

import 'jquery';
import 'bootstrap';

export function configure(aurelia) {
  aurelia.use
    .standardConfiguration()
    .developmentLogging();

  //Uncomment the line below to enable animation.
  //aurelia.use.plugin('aurelia-animator-css');
  //if the css animator is enabled, add swap-order="after" to all router-view elements

  //Anyone wanting to use HTMLImports to load views, will need to install the following plugin.
  //aurelia.use.plugin('aurelia-html-import-template-loader')

  aurelia.start().then(() => aurelia.setRoot());
}

私も試してみimport $ from 'jquery'ましたが、BS4 で aurelia スケルトンをスピンアップすると、次のようになります。

Uncaught Error: Bootstrap's JavaScript requires jQuery

コンソールに移動して $ を実行すると、jquery が返されます。競合状態だと思いますが、修正方法がわかりませんか?

編集: System.config

System.config({
  defaultJSExtensions: true,
  transpiler: "none",
  paths: {
    "*": "dist/*",
    "github:*": "jspm_packages/github/*",
    "npm:*": "jspm_packages/npm/*"
  },
  meta: {
    "bootstrap": {
      "deps": [
        "jquery"
      ]
    }
  },
  map: {
4

3 に答える 3

3

使用するjspm install bootstrap=github:twbs/bootstrap@4.0.0-alpha.2

fromでのインストールbootstrapに問題があります(こちらを参照)。jspmnpm:

インポート方法については、このファイルを参照してください (このプロジェクトから)。

更新:これは、これを修正する必要があるプル リクエストです。

于 2016-06-15T17:22:03.890 に答える