0

我试图实现我在 RailsApp 中购买的 metronic 管理主题。

一切都很好,但是当我点击一个链接时,整个 UI 都不起作用。我认为这是一个 JavaScript 问题。

我做了什么:

* copy assets:
* copy `/metronic_v5.0.3/metronic_v5.0.3/theme/src/vendors/flaticon` to `vendor/assets/metronic/flaticon`
* copy `/metronic_v5.0.3/metronic_v5.0.3/theme/src/vendors/metronic/fonts` to `vendor/assets/metronic/fonts`
* copy `/metronic_v5.0.3/metronic_v5.0.3/theme/src/vendors/metronic/css` to `vendor/assets/metronic/css`
* copy `/metronic_v5.0.3/metronic_v5.0.3/theme/src/vendors/line-awesome` to `vendor/assets/metronic/line-awesome`
* copy `/metronic_v5.0.3/metronic_v5.0.3/theme/dist/html/demo3/assets/demo/demo3/base/style.bundle.css` to `vendor/assets/metronic/theme/style.bundle.css`
* copy `/metronic_v5.0.3/metronic_v5.0.3/theme/dist/html/demo3/assets/demo/demo3/base/scripts.bundle.js` to `vendor/assets/metronic/theme/scripts.bundle.js`
* copy `/metronic_v5.0.3/metronic_v5.0.3/theme/dist/html/default/assets/vendors/base/fonts/font-awesome` to `vendor/assets/metronic/font-awesome`
* copy `/metronic_v5.0.3/metronic_v5.0.3/theme/dist/html/default/assets/vendors/base/vendors.bundle.css` to `vendor/assets/metronic/theme/vendors.bundle.css`
* copy `/metronic_v5.0.3/metronic_v5.0.3/theme/dist/html/default/assets/vendors/base/vendors.bundle.js` to `vendor/assets/metronic/theme/vendors.bundle.js`

* copy images:
* copy `/metronic_v5.0.3/metronic_v5.0.3/theme/dist/html/demo3/assets/app/media/img/bg/bg-2.jpg` to `app/assets/images/metronic/bg-2.jpg`
* copy `/metronic_v5.0.3/metronic_v5.0.3/theme/dist/html/demo3/assets/demo/demo3/media/img/logo/logo.png` to `app/assets/images/metronic/bg-2.jpg`

* install third party:
* cd `/metronic_v5.0.3/metronic_v5.0.3/tools`
* run `npm install && bower install`
* run `$(which gulp) --prod`
* copy `/metronic_v5.0.3/metronic_v5.0.3/tools/bower_components/malihu-custom-scrollbar-plugin` to `vendor/assets/metronic/bower_components/malihu-custom-scrollbar-plugin`

我的应用程序.scss:

@import "bootstrap";

// Metronic
@import "theme/vendors.bundle.css";
@import "theme/style.bundle.css";
@import "css/styles.css";
@import "flaticon/css/flaticon.css";
@import "line-awesome/css/line-awesome.min.css";
@import "bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.min.css";

和我的 application.js:

//= require rails-ujs
//= require jquery3
//= require jquery.turbolinks
//= require popper
//= require bootstrap

// Metronic
//= require theme/vendors.bundle.js
//= require theme/scripts.bundle.js
//= require bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.concat.min.js
//= require turbolinks
//= require_tree .

我用这段代码找到了几个解决方案:

$( document ).on('turbolinks:load', function() {
  // your code
}

但是我应该为“你的代码”使用什么。我无法重新加载整个主题/vendors.bundle.js 并需要主题/scripts.bundle.js 或?

如果有人可以帮助我,那就太好了。

4

0 回答 0