gpt4 book ai didi

jquery - 尝试将 jQuery-UI 添加到 Angular 4 应用程序时,TypeError : t. fx 未定义

转载 作者:太空狗 更新时间:2023-10-29 17:02:35 25 4
gpt4 key购买 nike

我正在尝试将 jQuery-UI 添加到应用程序,因为我需要访问一些 slider 。我已经为 jQuery 安装了类型:

npm install @types/jquery --save

什么似乎是 jQuery-UI 类型

npm install @types/jqueryui --save

我已将 jQuery 和 jQuery-UI CDN 引用添加到 index.html

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>SimutronApp</title>
<base href="/">
<script
src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha256-k2WSCIexGzOj3Euiig+TlR8gA0EmPjuc79OEeY5L45g="
crossorigin="anonymous">
</script>
<script
src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"
integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU="
crossorigin="anonymous">
</script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root>Loading...</app-root>
</body>
</html>

但是,在 Firefox 中我得到错误:

t.fx is undefined     jquery-ui.min.js:6

Chrome 抛出:

cannot read property 'step' of undefined at <String>.anonymous

在同一行。谁能告诉我将 jQuery-UI 添加到 Angular 4 项目的正确方法?

最佳答案

Jquery Slim 移除了一些 Jquery UI 依赖的特性。

替换

  <script
src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha256-k2WSCIexGzOj3Euiig+TlR8gA0EmPjuc79OEeY5L45g="
crossorigin="anonymous">

与:

<script src="http://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>

关于jquery - 尝试将 jQuery-UI 添加到 Angular 4 应用程序时,TypeError : t. fx 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43712113/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com