我以前没有看过这种语法,我想知道它的全部内容.
var { Navigation } = require('react-router');
Run Code Online (Sandbox Code Playgroud)
左侧的括号抛出语法错误:
意外的标记 {
我不确定webpack配置的哪个部分正在转换或者语法的目的是什么.这是和谐的事吗?有人可以开导我吗?
我想安装最新的稳定版本的节点 - 版本0.6.19(稳定).
http://blog.nodejs.org/表示将NPM升级到1.1.24
有没有一种简单的升级方法?我无法弄清楚如何下载和定位此版本.
下面给我npm -v 1.0.106
npm upgrade npm
Run Code Online (Sandbox Code Playgroud)
要么
npm upgrade npm 1.1.24
Run Code Online (Sandbox Code Playgroud) 我在PHP中从字符串调用类方法时遇到问题.这是一个简单的例子.一旦我开始工作,我将使用变量作为方法名称.
这是我正常调用方法的方法:
$tags_array = $this->get_tags_for_image($row["id"]);
Run Code Online (Sandbox Code Playgroud)
这是我正在尝试但得到错误的方式:
$tags_array = call_user_func('get_images_for_tag', $row["id"]);
Run Code Online (Sandbox Code Playgroud)
我必须错过范围,但我无法弄清楚如何调用该方法.
----编辑想通了这个调用方法但是现在我认为$ row是未定义的
$tags_array = call_user_func(array($this, 'get_images_for_tag'), $row["id"]);
Run Code Online (Sandbox Code Playgroud)
完整代码块:
$images = call_user_func(array($this, 'get_images_for_tag'), $filter);
foreach ($images as $row){
$tags_array = call_user_func(array($this, 'get_images_for_tag'), $row["id"]);
foreach ($tags_array as $tag_row){
$tags_array[] = $tag_row["tag"];
}
$image_array []= array (
'url' => $this->gallery_path_url . '/'. $row["name"],
'thumb_url' => $this->gallery_path_url . '/thumbs/' . 't_'. $row["name"],
'id' => $row["id"],
'description' => $row["description"],
//'url' => $row["url"],
'tags' => $tags_array
);
}
Run Code Online (Sandbox Code Playgroud) 我正在使用webpack测试我的生产javascript与minifcation.它工作正常没有明确,但当我添加-p
标志:
NODE_ENV=production ./node_modules/webpack/bin/webpack.js -p --progress --colors
Run Code Online (Sandbox Code Playgroud)
我收到警告,并且有javascript错误.似乎它正在删除不应该删除的东西.无法弄清楚为什么.
警告:
WARNING in client.js from UglifyJs
Side effects in initialization of unused variable React [./~/fluxible/lib/Fluxible.js:12,0]
Dropping unused function $$$enumerator$$makeSettledResult [./~/fluxible/~/es6-promise/dist/es6-promise.js:361,0]
Side effects in initialization of unused variable $$utils$$now [./~/fluxible/~/es6-promise/dist/es6-promise.js:35,0]
Side effects in initialization of unused variable $$utils$$o_create [./~/fluxible/~/es6-promise/dist/es6-promise.js:38,0]
Dropping unused variable internals [./~/react-router/~/qs/lib/utils.js:6,0]
Dropping side-effect-free statement [./~/fluxible/addons/provideContext.js:6,0]
Side effects in initialization of unused variable Action [./~/fluxible/~/dispatchr/lib/Dispatcher.js:7,0]
Dropping unused variable internals [./~/react-router/~/qs/lib/index.js:9,0]
Run Code Online (Sandbox Code Playgroud)
这是我的webpack.config.js
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var path = require('path');
module.exports …
Run Code Online (Sandbox Code Playgroud) 我在 LESS 文件中创建 2 个变量
@navSpritePath: '/i/data-board/navigation/navigation-sprite.gif';
@navSpritePath2x: ~`@{navSpritePath}.replace(/\.[\w\?=]+$/, function(match) { return "@2x" + match; })`;
Run Code Online (Sandbox Code Playgroud)
有没有办法抽象@navSpritePath2x的分配,以便我只需传递执行函数的路径并返回字符串?
LESS 有自己的数学和颜色辅助函数。我想创建自己的,所以它看起来像:
@navSpritePath: '/i/data-board/navigation/navigation-sprite.gif';
@navSpritePath2x: createPath2x(@navSpritePath);
///sudo code - does not work
.createPath2x (@path){
~`@{path}.replace(/\.[\w\?=]+$/, function(match) { return "@2x" + match; })`;
}
Run Code Online (Sandbox Code Playgroud) 例:
$("#footer-create-nav li").click(function () {
var $this = $(this);
$this.addClass('footer-create-active');
$this.siblings().removeClass('footer-create-active');
return false;
}
Run Code Online (Sandbox Code Playgroud)
与我的代码看起来很多:
$("#footer-create-nav li").click(function () {
$(this).addClass('footer-create-active');
$(this).siblings().removeClass('footer-create-active');
return false;
}
Run Code Online (Sandbox Code Playgroud)