- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
尝试在我的 React 应用程序中使用 Survey.js。当尝试加载调查编辑器时,我可以加载初始界面,但在尝试编辑问题时遇到问题。“编辑”和“...”按钮不起作用。他们触发了图中所示的错误。
已在 WebpackConfig 中添加 Jquery ProvidePlugin。
new webpack.ProvidePlugin({
jQuery: 'jquery',
$: 'jquery',
jquery: 'jquery'
}),
在添加插件之前,很多其他按钮都不起作用。现在我只对上述按钮有问题。也可能是与引导相关的问题。
Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_2_jquery__(...).modal is not a function
at SurveyPropertyEditorShowWindow.show (bundle.js:201317)
at SurveyEditor.showQuestionEditor (bundle.js:205389)
at Array.<anonymous> (bundle.js:205275)
at Event.fire (bundle.js:224746)
at SurveyForDesigner._this.editQuestionClick (bundle.js:204387)
at HTMLButtonElement.btn.onclick (bundle.js:204485)
下面是我的 Webpack.config
'use strict';
var autoprefixer = require('autoprefixer');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
var InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
var WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
var getClientEnvironment = require('./env');
var paths = require('./paths');
// Webpack uses `publicPath` to determine where the app is being served from.
// In development, we always serve from the root. This makes config easier.
var publicPath = '/';
// `publicUrl` is just like `publicPath`, but we will provide it to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing slash as %PUBLIC_PATH%/xyz looks better than %PUBLIC_PATH%xyz.
var publicUrl = '';
// Get environment variables to inject into our app.
var env = getClientEnvironment(publicUrl);
// This is the development configuration.
// It is focused on developer experience and fast rebuilds.
// The production configuration is different and lives in a separate file.
module.exports = {
// You may want 'eval' instead if you prefer to see the compiled output in DevTools.
// See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.
devtool: 'cheap-module-source-map',
// These are the "entry points" to our application.
// This means they will be the "root" imports that are included in JS bundle.
// The first two entry points enable "hot" CSS and auto-refreshes for JS.
entry: [
// Include an alternative client for WebpackDevServer. A client's job is to
// connect to WebpackDevServer by a socket and get notified about changes.
// When you save a file, the client will either apply hot updates (in case
// of CSS changes), or refresh the page (in case of JS changes). When you
// make a syntax error, this client will display a syntax error overlay.
// Note: instead of the default WebpackDevServer client, we use a custom one
// to bring better experience for Create React App users. You can replace
// the line below with these two lines if you prefer the stock client:
// require.resolve('webpack-dev-server/client') + '?/',
// require.resolve('webpack/hot/dev-server'),
require.resolve('react-dev-utils/webpackHotDevClient'),
// We ship a few polyfills by default:
require.resolve('./polyfills'),
// Finally, this is your app's code:
paths.appIndexJs
// We include the app code last so that if there is a runtime error during
// initialization, it doesn't blow up the WebpackDevServer client, and
// changing JS code would still trigger a refresh.
],
output: {
// Next line is not used in dev but WebpackDevServer crashes without it:
path: paths.appBuild,
// Add /* filename */ comments to generated require()s in the output.
pathinfo: true,
// This does not produce a real file. It's just the virtual path that is
// served by WebpackDevServer in development. This is the JS bundle
// containing code from all our entry points, and the Webpack runtime.
filename: 'static/js/bundle.js',
// This is the URL that app is served from. We use "/" in development.
publicPath: publicPath
},
resolve: {
// This allows you to set a fallback for where Webpack should look for modules.
// We read `NODE_PATH` environment variable in `paths.js` and pass paths here.
// We use `fallback` instead of `root` because we want `node_modules` to "win"
// if there any conflicts. This matches Node resolution mechanism.
// https://github.com/facebookincubator/create-react-app/issues/253
fallback: paths.nodePaths,
// These are the reasonable defaults supported by the Node ecosystem.
// We also include JSX as a common component filename extension to support
// some tools, although we do not recommend using it, see:
// https://github.com/facebookincubator/create-react-app/issues/290
extensions: ['.js', '.json', '.jsx', ''],
alias: {
// Support React Native Web
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
'react-native': 'react-native-web'
}
},
module: {
// First, run the linter.
// It's important to do this before Babel processes the JS.
preLoaders: [
{
test: /\.(js|jsx)$/,
loader: 'eslint',
include: paths.appSrc,
}
],
loaders: [
// ** ADDING/UPDATING LOADERS **
// The "url" loader handles all assets unless explicitly excluded.
// The `exclude` list *must* be updated with every change to loader extensions.
// When adding a new loader, you must add its `test`
// as a new entry in the `exclude` list for "url" loader.
// "url" loader embeds assets smaller than specified size as data URLs to avoid requests.
// Otherwise, it acts like the "file" loader.
{
exclude: [
/\.html$/,
// We have to write /\.(js|jsx)(\?.*)?$/ rather than just /\.(js|jsx)$/
// because you might change the hot reloading server from the custom one
// to Webpack's built-in webpack-dev-server/client?/, which would not
// get properly excluded by /\.(js|jsx)$/ because of the query string.
// Webpack 2 fixes this, but for now we include this hack.
// https://github.com/facebookincubator/create-react-app/issues/1713
/\.(js|jsx)(\?.*)?$/,
/\.css$/,
/\.json$/,
/\.svg$/
],
loader: 'url',
query: {
limit: 10000,
name: 'static/media/[name].[hash:8].[ext]'
}
},
// Process JS with Babel.
{
test: /\.(js|jsx)$/,
include: paths.appSrc,
loader: 'babel',
query: {
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
// directory for faster rebuilds.
cacheDirectory: true
}
},
// "postcss" loader applies autoprefixer to our CSS.
// "css" loader resolves paths in CSS and adds assets as dependencies.
// "style" loader turns CSS into JS modules that inject <style> tags.
// In production, we use a plugin to extract that CSS to a file, but
// in development "style" loader enables hot editing of CSS.
{
test: /\.css$/,
loader: 'style!css?importLoaders=1!postcss'
},
// JSON is not enabled by default in Webpack but both Node and Browserify
// allow it implicitly so we also enable it.
{
test: /\.json$/,
loader: 'json'
},
// "file" loader for svg
{
test: /\.svg$/,
loader: 'file',
query: {
name: 'static/media/[name].[hash:8].[ext]'
}
}
// ** STOP ** Are you adding a new loader?
// Remember to add the new extension(s) to the "url" loader exclusion list.
]
},
// We use PostCSS for autoprefixing only.
postcss: function() {
return [
autoprefixer({
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
]
}),
];
},
plugins: [
new webpack.ProvidePlugin({
jQuery: 'jquery',
$: 'jquery',
jquery: 'jquery'
}),
// Makes some environment variables available in index.html.
// The public URL is available as %PUBLIC_URL% in index.html, e.g.:
// <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
// In development, this will be an empty string.
new InterpolateHtmlPlugin(env.raw),
// Generates an `index.html` file with the <script> injected.
new HtmlWebpackPlugin({
inject: true,
template: paths.appHtml,
}),
// Makes some environment variables available to the JS code, for example:
// if (process.env.NODE_ENV === 'development') { ... }. See `./env.js`.
new webpack.DefinePlugin(env.stringified),
// This is necessary to emit hot updates (currently CSS only):
new webpack.HotModuleReplacementPlugin(),
// Watcher doesn't work well if you mistype casing in a path so we use
// a plugin that prints an error when you attempt to do this.
// See https://github.com/facebookincubator/create-react-app/issues/240
new CaseSensitivePathsPlugin(),
// If you require a missing module and then `npm install` it, you still have
// to restart the development server for Webpack to discover it. This plugin
// makes the discovery automatic so you don't have to restart.
// See https://github.com/facebookincubator/create-react-app/issues/186
new WatchMissingNodeModulesPlugin(paths.appNodeModules)
],
// Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works.
node: {
fs: 'empty',
net: 'empty',
tls: 'empty'
}
};
最佳答案
entry: {
'js/vendor': 'bootstrap-loader',
...
},
...
plugins: [
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery",
}),
new webpack.optimize.CommonsChunkPlugin(
"js/vendor",
"js/vendor.bundle.js"
)
],
并尝试从index.html加载js/vendor.bundle.js
而不是从cdn加载 Bootstrap 。它应该可以工作。
我之前也遇到过同样的问题,但是我删除了 jquery,我不需要在我的 React 项目中再使用 Jquery
关于javascript - React - Survey.js ...调查项目的编辑按钮不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45347071/
是否有任何工具可以检查现有的 squashfs 图像并找出每个文件的压缩率? 如果它可以帮助我估计一个巨大的可执行文件中静态链接符号的闪存使用情况,则可以加分。 最佳答案 7zip 程序可以提供这些信
我有自定义调查,在 RootWeb.Properties 中有到期日期。如何在到期日期后将所有想要回复调查的用户(单击“回复调查”或使用指向 NewForm.aspx 的直接链接)重定向到包含一些自定
是否可以通过查询字符串发送答案?像这样的东西: HTTP://survey/1?ASW1=test 最佳答案 是的,请参阅手册 - https://manual.limesurvey.org/Work
我问了一个question关于如何在调试时调查 XMLWriter 对象的内容。我正在尝试检查从内存流创建的 XmlReader 对象的内容,其方式与链接问题的答案中给出的方式类似。但是我收到 Una
如何在调试时查看完全填充的 XmlWriter 对象的 XML 内容。我的 Silverlight 应用程序不允许实际写入文件和检查内容。 最佳答案 让它写入 MemoryStream或 String
我今天才开始使用 AB。阅读一些新的 AB 教程,并尝试尝试对我的网站进行负载测试。 使用它几次后,我收到了大量失败的请求。你能解释一下失败的请求是什么意思吗?我该如何针对此问题进行更多调查? 示例
当我运行 project 时与 valgrind我收到错误报告。如果我不使用 Valgrind,那么程序看起来是正常的,但是当 Valgrind 报告它时,我确定有问题。 ==21286== Inva
我在一页上有 36 个常见问题解答和答案。每个答案都包含在一个可折叠元素中。我的目标是让用户在常见问题解答中单击是或否,然后我通过 GTM/GA 跟踪该值。但是,当我当前单击是或否时,该值显示“感谢您
我们在 aws 上的 hdfs 之上有一个 spark 集群,具有 2 个核心节点和 1 个主节点。最近我发现所有作业都失败了,因为两个核心节点上的磁盘都已满。经过进一步调查发现: /data/var
我正在构建一个 Web 应用程序,它基本上允许“管理员”创建具有任意数量和组合的表单元素(复选框、组合框、文本字段、日期字段、单选组等)的表单。 “用户”将登录此应用程序并完成管理员创建的表格。 我们
想象一下这样的情况。您获得了一些遗留代码或获得了一些新框架。您需要尽快调查并了解如何使用此代码。没有机会向以前的开发人员寻求帮助。什么是最佳实践/方法/方式/步骤/工具(首选 .NET Framewo
我正在尝试从在 MacOS 上运行的 docker 容器访问 host-x.com,但它失败了: $ docker run ubuntu:latest \ /bin/bash -c \ '
我最近研究了 WinForms 应用程序中的一些 .NET“内存泄漏”(即意外的、挥之不去的 GC 根对象)。加载然后关闭一个巨大的报告后,即使经过几次 gen2 收集,内存使用量也没有按预期下降。假
如何允许具有读取权限的用户回复 Sharepoint 2013 调查? 我尝试过仅读取访问权限,但无法获取“回复调查”链接。我还尝试了“贡献访问”选项,这一次,我得到了“回复调查”按钮。当我尝试填写调
如何允许具有读取权限的用户响应 Sharepoint 2013 调查? 我试过只有读取权限,但无法获得“回复调查”链接。我也尝试了“贡献访问”选项,这次,我得到了“响应调查”按钮。当我尝试填写调查详细
目前我正在深入研究 CLR 并尝试找到我的托管对象的适当大小。 我有两个简单的类型: XClass class XClass { public XStruct StructField
我正在调查在由 mesos marathon 编排的 docker 容器中运行的 java 应用程序的内存不足问题。 容器设置为2GB内存 JVM 堆显式设置为最小 1Gb 和最大 1.5GB 持续测
在使用/FA 选项编译使用此虚拟类的代码时 class A { public: A() {} int Initialize() { return 0; } }
我正尝试在 Symfony 3.2.4 和 PHP 5.6.28 中为我的应用程序创建动态调查/表单包 我有 3 个实体:调查/问题/答案 第一步是为每个用户创建一个调查。问题必须与相关的答案字段一起
我正在尝试将一个简单的调查嵌入到弹出窗口中并将其与我的应用程序集成。弹出窗口需要包含一个调查问题,该问题将使用两个选项单选按钮捕获用户的响应。一旦用户选择单选选项,我需要触发一个事件以启用提交按钮。单
我是一名优秀的程序员,十分优秀!