最近我在Chrome浏览器上登录了我的FB帐户.当我打开开发人员工具时,我看到了这样的事情:

现在我知道可以使用javascript console.log函数向控制台添加任何内容.但我的问题是 - 他们是如何为文本添加风格的?例如"停止!" 是用红色tahoma字体写的,黑色边框和更大的尺寸.他们是如何做到的呢?
考虑以下示例:
function previewFile(file) {
var reader = new FileReader();
reader.onloadend = function () {
console.log(reader.result);
}
reader.readAsDataURL(file);
}
Run Code Online (Sandbox Code Playgroud)
它指出:
instanceOfFileReader.readAsDataURL(BLOB);
blob:要从中读取的Blob或文件.
如何将本地文件URL 'file:///C:/path-to/root.png'传递给readAsDataURL()
是否FileReader()可以在Firefox的附加组件?
我正在尝试创建一个postHTTP请求,其中包含一些要设置的表单参数.我正在使用带有节点服务器的axios.我已经有一个构建url的java代码实现,如下所示:
JAVA代码:
HttpPost post = new HttpPost(UriBuilder.fromUri (getProperty("authServerUrl"))
.path(TOKEN_ACCESS_PATH).build(getProperty("realm")));
List<NameValuePair> formParams = new ArrayList<NameValuePair>();
formParams.add(new NameValuePair("username",getProperty ("username")));
formParams.add(new NameValuePair("password",getProperty ("password")));
formParams.add(new NameValuePair("client_id, "user-client"));
Run Code Online (Sandbox Code Playgroud)
我想在axios做同样的事情.
AXIOS实施:
axios.post(authServerUrl +token_access_path,
{
username: 'abcd', //gave the values directly for testing
password: '1235!',
client_id: 'user-client'
}).then(function(response) {
console.log(response); //no output rendered
}
Run Code Online (Sandbox Code Playgroud)
在邮政要求上设置这些形式参数的方法是否正确?
我的angular应用程序现在不断变化,因为我们的团队现在正在快速更新.
由于缓存,我们的客户并不总是拥有我们代码的最新版本.
那么有一种方法angular可以强制浏览器清除缓存吗?
删除bower_components并使缓存清理后,我使用bower install重新安装了依赖项.该应用无法加载以下错误未捕获错误:[$ injector:unpr]未知提供商:$$ forceReflowProvider < - $$ forceReflow < - $$ animateQueue < - $ animate < - $ compile < - $$ animateQueue
这是我的bower.json
{
"name": "angular-zolo",
"version": "0.0.0",
"dependencies": {
"angular": "1.4.3",
"json3": "~3.3.1",
"es5-shim": "~3.0.1",
"bootstrap-sass-official": "~3.1.1",
"bootstrap": "~3.1.1",
"angular-resource": ">=1.2.*",
"angular-cookies": ">=1.2.*",
"angular-sanitize": ">=1.2.*",
"angular-bootstrap": "~0.11.0",
"font-awesome": ">=4.1.0",
"lodash": "~2.4.1",
"angular-socket-io": "~0.6.0",
"angular-ui-router": "~0.2.15",
"angular-material": "master",
"material-date-picker": "~1.1.7",
"ng-table": "~0.7.1",
"md-data-table": "*",
"ngstorage": "~0.3.7",
"ng-file-upload": "~6.0.4",
"velocity": "~1.2.2",
"nprogress": "~0.2.0"
},
"devDependencies": {
"angular-mocks": ">=1.2.*",
"angular-scenario": …Run Code Online (Sandbox Code Playgroud) 使用纯JavaScript对象时,可以轻松更改深层嵌套的对象属性:
people.Thomas.nickname = "Mr. T";
Run Code Online (Sandbox Code Playgroud)
但是对于Immutable,我必须在拥有一个新的人物对象之前浏览每个属性的祖先:
var thomas = peopleImmutable.get("Thomas");
var newThomas = thomas.set("nickname", "Mr .T");
peopleImmutable = peopleImmutable.set("Thomas", newThomas);
Run Code Online (Sandbox Code Playgroud)
是否有更优雅的方式来写这个?
无论我的Promise是否成功解决,我都希望运行相同的操作.我不想将同一个函数绑定到两个args .then.是不是.always像jQuery一样?如果没有,我该如何实现?
我正在使用redux而且我不确定如何组织我的组件,我认为最好将它们保存在文件夹中,主要组件的名称作为文件夹的名称和内部的所有内部组件:
components
Common/ things like links, header titles, etc
Form/ buttons, inputs, etc
Player/ all small components forming the player
index.js this one is the top layout component
playBtn.js
artistName.js
songName.js
Episode/ another component
然后,在容器文件夹中,我每页只有一个容器,这是我实际连接到Redux的唯一容器:
containers/ HomePageApp.js EpisodePageApp.js ...
然后每个顶部组件的操作是一个,而不是每页一个,所以在我连接到Redux的页面容器中,我传递了该页面中使用的组件的所有操作.例如:
actions/ Player.js Episode.js ...
我这样做了吗?我没有找到关于谷歌搜索的很多信息,我发现我认为它们仅限于小项目.
谢谢!
所以我有Rails应用程序,我安装了react-rails gem,设置它并尝试运行测试应用程序.
新安装的,当我试图运行hello world程序时,这个错误变得很糟糕:
未捕获的ReferenceError:未定义ReactDOM
这是我的反应:
var HelloWorld = React.createClass({
render: function() {
return (
<p>
Hello, <input type="text" placeholder="Your name here" />!
It is {this.props.date.toTimeString()}
</p>
);
}
});
setInterval(function() {
ReactDOM.render(
<HelloWorld date={new Date()} />,
document.getElementById('example')
);
}, 500);
Run Code Online (Sandbox Code Playgroud)
它保存在/app/assets/javascripts/components/test.js.jsx文件中.
Rails 4.2.4使用Ruby 2.2.3
我有一个React组件
export default class Archive extends React.Component {
...
}
Run Code Online (Sandbox Code Playgroud)
componentDidMount和onClick方法部分使用相同的代码,除了参数的微小变化.
是否可以在组件类中创建一个函数,以便可以在组件的范围内重用它?
javascript ×10
reactjs ×3
angularjs ×2
axios ×1
caching ×1
console.log ×1
css ×1
ecmascript-6 ×1
es6-promise ×1
html5 ×1
immutable.js ×1
node.js ×1
reactjs-flux ×1
redux ×1
ruby ×1