如何将jQuery UI(jqueryui)与StackBlitz和TypeScript和NPM一起使用 [英] How can I use jQuery UI (jqueryui) with StackBlitz and TypeScript and NPM

查看:67
本文介绍了如何将jQuery UI(jqueryui)与StackBlitz和TypeScript和NPM一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在

I am trying to use jQuery UI in StackBlitz.

I am also trying to install it as a dependency and without a script tag.

I understand that I have to add @types/jquery and @types/jqueryui as dependencies.

But when I add this in the index.ts

import $ from "jquery";
import "jqueryui";

I get the error: "jQuery is not defined"

解决方案

This code seems to do the trick:

import $ from "jquery";
declare var global: any
global.jQuery = $;
import "jqueryui";

Here is a screenshot of the dependencies:

这篇关于如何将jQuery UI(jqueryui)与StackBlitz和TypeScript和NPM一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆