语义 UI 行为在 Meteor 1.3 中不起作用 [英] Semantic UI Behaviors Not Working in Meteor 1.3
问题描述
我决定将我正在开发的新应用升级到 Meteor 1.3 版本.我按照 MDG 的官方指南"说明推荐的目录布局,并且对我的 FlowRouter 代码进行了一些重构,使该应用程序几乎可以正常工作.问题似乎出在从 Atmosphere 安装的语义 UI 包 (2.1.8) 上.我确实需要将适当的 SUI *.less 文件添加到client"目录中的顶级main.less"文件中,以使应用程序呈现正确样式的视图.然而,昨天在 Meteor 1.2 中运行良好的 SUI 行为不再起作用.
I decided to upgrade the new app I am developing to the Meteor 1.3 release. I followed 'The Official Guide' instructions from MDG for the recommended directory layout and, with a bit of refactoring of my FlowRouter code, was able to get the app almost working. The problem seems to be with the Semantic UI package (2.1.8) installed from Atmosphere. I did need to add the appropriate SUI *.less files to a top-level 'main.less' file in the 'client' directory to get the app to render a properly styled view. However, the SUI behaviors which worked nicely in Meteor 1.2 yesterday no longer work.
我的假设是我需要使用表单导入 SUI 行为...
My assumption is that I need to import the SUI behaviors using the form...
从'meteor/semantic:ui'导入一些东西;
import something from 'meteor/semantic:ui';
...但我一直无法识别正确的导入语句.语义 UI 没有为其库提供典型的命名空间,因此所有明显的想法都不起作用.
...but I haven't been able to identify the correct import statement. Semantic UI doesn't present a typical namespace for its library so none of the obvious ideas worked.
是否有人能够仅使用标准的 Blaze 模板就使 SUI 与 1.3 一起工作?
Has anybody been able to get SUI working with 1.3 just using standard Blaze templates?
推荐答案
也许以下几点可能有所帮助,或提供进一步查询的提示:
Maybe one of the following points may help, or give a hint for further inquiry:
- 确保 Semantic UI 文件夹位于
/client/lib/semantic-ui
(无需在其他地方导入任何内容,只需使用 css 类即可). - 确保安装了 Atmosphere 包
semantic:ui
和flemay:less-autoprefixer
.因此,Semantic UI 文件夹中的所有.less
文件都将自动转换. - 如果您需要语义 UI模块"的 JavaScript 功能(例如下拉菜单),则需要在页面加载时启动该功能.例如
$(".ui.dropdown").dropdown("initialize")
或"refresh"
.此处您可以找到对这些所谓模块行为"的一些描述.行为由$('.your.element').module('behavior name', argumentOne, argumentTwo)
定义.
- Make sure the hole Semantic UI folder is at
/client/lib/semantic-ui
(no need to import anything elsewhere, just use the css classes). - Make sure the Atmosphere packages
semantic:ui
andflemay:less-autoprefixer
are installed. So all.less
files within the Semantic UI folder will be converted automatically. - If you need the JavaScript functionality of Semantic UI "Modules", like dropdowns, you need to initiate the functionality on page load. For example with
$(".ui.dropdown").dropdown("initialize")
or"refresh"
. Here you find some description of these so called "module behaviors". Behaviors are defined by$('.your.element').module('behavior name', argumentOne, argumentTwo)
.
这篇关于语义 UI 行为在 Meteor 1.3 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!