【问题标题】:How to load jQuery-ui with Asp Core+ Angular 4 template from VS 2017如何使用 VS 2017 中的 Asp Core+ Angular 4 模板加载 jQuery-ui
【发布时间】:2018-04-12 19:56:21
【问题描述】:

我使用 VS 2017 中的 Asp Core+webpack+ Angular 4 模板。如何加载 jQuery-ui, 我把它放到 webpack.config.vendor.js 中:

const treeShakableModules = [
    '@angular/animations',
    '@angular/common',
    '@angular/compiler',
    '@angular/core',
    '@angular/forms',
    '@angular/http',
    '@angular/platform-browser',
    '@angular/platform-browser-dynamic',
    '@angular/router',
    'font-awesome/css/font-awesome.css',
    'zone.js',
    'virtual-keyboard',
    'jquery-ui'                   //Here

但我不认为这是正确的

将 js/css 文件包含到 webpack 的正确方法是什么?

谢谢

【问题讨论】:

标签: node.js angular jquery-ui npm webpack


【解决方案1】:

你现在应该知道了,但是在packages.json中添加了npm依赖;这个应该放在Dependencies 部分。您还需要DevDependencies 部分中的'@types/jquery-ui' 才能从 TypeScript 内部访问 API,您应该在代码中导入该 API。修改文件并保存后,等待一两分钟让项目更新(您可以在输出窗口的 npm 部分查看进度)。由于我自己没有使用 jQuery UI,因此可能还需要几个其他步骤(例如在您的页面中添加 <script><link> 指令)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-05-31
    • 2018-02-04
    • 2018-02-21
    • 2018-06-22
    • 2018-07-12
    • 2010-10-24
    • 1970-01-01
    相关资源
    最近更新 更多