- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将 Jquery Rateyo 导入到我的项目中,但似乎不起作用。这是代码
import $ from "jquery";
import rateYo from "rateyo";
class Rating {
constructor() {
$(function() {
$("#rateYo").rateYo({
rating: 1.5,
starWidth: "40px",
numStars: 5,
halfStar: true
});
});
}
}
export default Rating;
我也在使用 webpack。
它不会显示在用户界面中。并且还会生成一个错误,指出:
jquery.js?1157:3841 jQuery.Deferred exception: jquery__WEBPACK_IMPORTED_MODULE_0___default(...)(...).rateYo is not a function TypeError: jquery__WEBPACK_IMPORTED_MODULE_0___default(...)(...).rateYo is not a function at HTMLDocument.eval (webpack-internal:///./js/modules/Rating.js:12:64) at mightThrow (webpack-internal:///./node_modules/jquery/dist/jquery.js:3557:29) at process (webpack-internal:///./node_modules/jquery/dist/jquery.js:3625:12) undefined
最佳答案
您需要使用jquery版本的模块@rateyo/jquery
您可以执行以下操作。
import $ from "jquery";
import "@rateyo/jquery";
$("#rateyo").rateYo();
顺便说一句,rateyo 期望 jquery >= 3.0.0
关于javascript - 如何导入Jquery RateYo?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60397621/
我正在尝试将 Jquery Rateyo 导入到我的项目中,但似乎不起作用。这是代码 import $ from "jquery"; import rateYo from "rateyo"; clas
我在我的项目中使用星级。我的星星出现的位置与我悬停在星星上的大小一样。当用户将鼠标悬停在上面时,我希望星星以全尺寸显示。有什么建议吗?我当前的 rateYo JS 函数如下所示。 在 JSP 中
我试过了,但我没有解决关于名为 rateYo 的完美 jquery 插件的问题。 我在此页面上准备了一个示例: http://jsfiddle.net/a1oewfwn/ $(".rateYo").r
我正在开发一个带有一些星级评级的页面,并且为此使用了rateYo插件( http://rateyo.fundoocode.ninja )。如果我使用一星级,一切都会正常工作,但我需要在该页面上的众多实
我有几篇文章是从数据库加载的,在模板中我将每个项目设置为具有这种结构: Rating: "> 但是,我无法设法从 data-rating 属性中获取值并将其放入每个元素中: $("
我正在尝试整合 Rateyo plugin使用 AngularJS 并从指令定义的评级值中获取问题,以下是代码: 编辑:这是工作 plunker Controller var app = angula
我计划在我的 Django 元素中使用 RateYo jQuery 插件,但我计划更改多个部分,因此我想将所有文件直接放在我的元素中(除非我可以使用 CDNjs 轻松修改 RateYo 选项进口) 官
我是一名优秀的程序员,十分优秀!