我需要能够为自定义按钮添加共享功能.我对他们的发电机不感兴趣,因为我无法改变那里的图像.我想将自己的图像用于linkedin分享按钮.
因此,在阅读Ansible文档后,我发现Handlers只有在任务报告更改时才会触发,例如:
some tasks ...
notify: nginx_restart
# our handler
- name: nginx_restart
Run Code Online (Sandbox Code Playgroud)
VS
some tasks ...
register: nginx_restart
# do this after nginx_restart changes
when: nginx_restart|changed
Run Code Online (Sandbox Code Playgroud)
这两种方法有什么区别吗?我什么时候应该使用它们?对我来说,register这里似乎有更多的功能,除非我遗漏了一些东西......
我还在学习React并且无法掌握它的重要性PropTypes.任何人都可以提出他们的想法,定义你的好处是PropTypes什么?我已经在React文档中阅读了关于此的讨论,但是我无法理解PropTypes在类型不匹配时不要看到控制台错误/警告的优点.它在文档上说
在设计接口时,将通用设计元素(按钮,表单域,布局组件等)分解为具有定义良好的接口的可重用组件.这样,下次需要构建一些UI时,可以编写更少的代码.这意味着更快的开发时间,更少的错误以及更少的线路数据.
除了好处,我还有一些其他问题:
PropTypes您肯定会编写更多与粗体相反的语句.PropTypes仅适用于子组件,因为父组件通常不具有道具?StateTypes这么说?我在MailChimp v3 API上遇到问题,当我尝试重新订阅成员时,它会以状态400响应.以下是重现问题的步骤:
通过端点使用API重新订阅PUT/lists/{list_id}/members/{subscriber_hash}返回状态400
{'type':' http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/','title ':'忘记电子邮件未订阅','状态':400,'详细':' some@email.com已被永久删除,无法重新导入.联系人必须重新订阅才能返回列表.}
并且请求是:
{
email_address: 'some@email.com',
status_if_new: 'subscribed'
}
Run Code Online (Sandbox Code Playgroud)
基于响应,解决方案是必须重新订阅成员,我实际上正在尝试做.有谁遇到过这个问题?
有没有办法分隔这种格式:
const { a, b, c, d, e, g, f, g, etc } = alphabet
Run Code Online (Sandbox Code Playgroud)
成
const {
a,
b,
c,
d,
e,
g,
f,
g,
etc } = alphabet
Run Code Online (Sandbox Code Playgroud)
容易?
经过几天无休止的搜索,我决定用我的周末创建一个扩展来实现这一目标.请参阅下面的答案.
我使用jquery ajax函数在一些输入字段和textarea中添加内容.只有textare使用TINYMCE.
然而,在ajax之后,TINYMCE中的文本不会刷新并保持不变.
如何使用jquery清空TINYMCE中的内容?
我目前的代码如下.
//on submit event
$("#specformentry").submit(function(event){
event.preventDefault();
if(checkForm()){
// var href = $(this).attr("href");
submitinput.attr({ disabled:true, value:"Sending..." });
//$("#send").blur();
//send the post to shoutbox.php
$.ajax({
type: "POST",
url: "../../Ajaxinsertspec",
data: $('#specformentry').serialize(),
complete: function(data){
update_entry();
specdesc.val('');
datecreated.val('');
detailstext.val('');
// this code is supposed to empty the INYMCE content, but it does not
//reactivate the send button
submitinput.attr({ disabled:false, value:"Enter Spec" });
}
});
}
else alert("Please fill all fields!");
//we prevent the refresh of the page after submitting the …Run Code Online (Sandbox Code Playgroud) 我一直在尝试通过函数指定弹出窗口的宽度和高度window.open。但是,一旦我将noopener选项包含在内,Chrome 上的宽度和高度就会被忽略。
这是我正在使用的代码,https://jsfiddle.net/v0otu1kq/在这种情况下,窗口会以指定的尺寸打开。
但是,一旦我包含noopener在选项中,例如https://jsfiddle.net/1eqtLsnr/,它就会忽略尺寸集。
document.querySelector('[data-frame]').addEventListener('click', function(e) {
e.preventDefault();
window.open(
'https://facebook.com',
'facebook-window',
'width=600,height=400,scrollbar=yes,noopener' // <-- this
);
});
Run Code Online (Sandbox Code Playgroud) 我一直在寻找,无法找到我的问题的答案.所以我想要一个仅在某些条件下显示的条件属性,例如:
<Button {this.state.view === 'default' && 'active'}></Button>
Run Code Online (Sandbox Code Playgroud)
正如你可以看到我只想指示按钮活跃,如果this.state.view是等于默认.但是,我明白了Unexpected token, error...
但是当我尝试在它之前放置一个属性时,例如:
<Button isActive={this.state.view === 'default' && 'active'}></Button>
Run Code Online (Sandbox Code Playgroud)
它传递语法错误并显示正常,但这不是我想要实现的.
我怎样才能解决这个问题?这可能是它没有通过的原因?
所以我发现在react-bootstrap属性中active是一个简写,active=true所以我用它来解决它
<Button active={this.state.view === 'default'}></Button>
Run Code Online (Sandbox Code Playgroud)
所以如果有人遇到这个问题,我就把它留在这里.但是,我仍然想知道为什么条件属性失败而没有将它包含在类似prop的语法中,例如:
这个:
active={this.state.view === 'default'}
Run Code Online (Sandbox Code Playgroud)
与
{this.state.view === 'default' && 'active'}
Run Code Online (Sandbox Code Playgroud) 有没有人遇到过这个错误:
Tunnel packager.yu-tyd.my-app.exp.direct not found
我的应用程序只是简单的hello world
import Expo from 'expo'
import React from 'react'
import { Text } from 'react-native'
const App = () => (
<Text>Hello World</Text>
)
Expo.registerRootComponent(App)
Run Code Online (Sandbox Code Playgroud)
不确定导致错误的原因.这是我的依赖项:
"dependencies": {
"@expo/ex-navigation": "^2.9.2",
"expo": "^15.0.2",
"react": "~15.4.0",
"react-native": "https://github.com/exponent/react-native/archive/sdk-15.0.0.tar.gz",
"react-redux": "^5.0.3",
"redux": "^3.6.0"
}
Run Code Online (Sandbox Code Playgroud)
我能错过什么?
我正在使用react-navigation:^1.0.0-beta.9有没有办法回到特定的屏幕(不是前一个到当前)?我也整合了我react-navigation的redux.我查看了文档并看到back接受了一个key参数然而这对我来说并不清楚,并尝试将其放在屏幕的名称中,back({ key: 'Screen B' })但它不起作用可能因为它期望key随机生成哪个除非特别指定.
例如我有这个 StackNavigator
Screen A
- Screen B
- Screen C
- Screen D (Current)
Run Code Online (Sandbox Code Playgroud)
假设我现在正在使用Screen D,我想回到Screen B如何实现它?
我不想使用,navigation.navigate('Screen B')因为它会在堆栈中添加另一个屏幕,而不是我期待的.
我知道该_.defaults函数可以为键为的对象放置默认值undefined。但是不适用于的键null。有办法实现吗?
我有这个结构:
学校 - > hasMany - > Classes
所以当我尝试下面的代码时 artisan tinker
App\School::with('schoolclasses')->find(2283)->schoolclasses;
Run Code Online (Sandbox Code Playgroud)
我可以毫无问题地获得课程.
但是当我尝试没有使用时,我仍然可以得到相同的结果而没有问题:
App\School::find(2283)->schoolclasses;
Run Code Online (Sandbox Code Playgroud)
是否Eloquent急于加载?如果是这样,如何禁用它?
javascript ×8
reactjs ×4
ecmascript-6 ×2
expo ×2
php ×2
react-native ×2
ansible ×1
api ×1
exponentjs ×1
html ×1
ide ×1
jquery ×1
jsx ×1
laravel ×1
laravel-5.1 ×1
linkedin ×1
lodash ×1
python ×1
share ×1
tinymce ×1
window.open ×1
yii ×1