如何使flex div仅占用所需的空间?它占用了所有可用空间.
我想排队div,在需要时包装.问题是Flex容器占用的空间比实际需要的多.
这是一个例子http://cssdeck.com/labs/wvhe64ot
#outer {
border: 5px solid green;
width: 400px;
}
#container {
display: flex;
border: 5px dashed black;
flex-wrap: wrap;
}
#container div {
padding: 10px;
border: 2px solid black;
}Run Code Online (Sandbox Code Playgroud)
Dashed border should be close to the small divs
<div id="outer">
<div id="container">
<div>Lipsum</div>
<div>Lipsum</div>
<div>Lorem ipsum dolor sit amet</div>
<div>Lorem ipsum dolor sit amet</div>
</div>
<div>Run Code Online (Sandbox Code Playgroud)
我有一个输入字段,值字段传递存储在Vuex中的字符串.取消输入字段更改并将新字符串同步到Vuex.
当这样绑定:value="vuexState.myString时,键入时,光标会跳转到行尾.
当这样绑定时value={{vuexState.myString}},光标保持原样.
根据指南:http://vuejs.org/guide/syntax.html#Arguments
这两个应该是相同的,{{ }}内部转换为样式:bind.这可能是个错误吗?
我的理论是发生光标跳跃是因为vuex状态更改重新呈现输入,并且{{ }}样式仅插入一次,而绑定语法在每次更改时重新呈现输入.
我目前正在使用,value={{vuexState.myString}}但我想知道发生了什么,或者是否有更好的方法来做到这一点.
我正在尝试在特定位置的nginx + php-fpm中提供CachetHQ.文档给出了这个作用的例子status.example.com(有效):
server {
listen 80;
server_name status.example.com;
root /var/www/Cachet/public;
index index.php;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
fastcgi_keep_conn on;
}
}
Run Code Online (Sandbox Code Playgroud)
但是,status.example.com我想服务于,而不是服务example.com/status.
我原以为这会起作用,但是从error.log我看到它正在尝试/etc/nginx/htmlindex.php,但它应该是/mnt/data/site/www-cachet/public/index.php:
location /status/ {
index index.php;
root /mnt/data/site/www-cachet/public;
try_files $uri index.php$is_args$args;
location ~ ^/status/.+\.php$ {
root /mnt/data/site/www-cachet/public;
include fastcgi_params;
fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
fastcgi_keep_conn on;
}
}
Run Code Online (Sandbox Code Playgroud) 我正在寻找一个(jQuery)事件处理程序,它在input[type="text"]值更改后立即执行一个函数.在.changejQuery的事件处理程序执行后的功能input[type="text"]失去焦点(这可能是很好的另一种情况).
keypress/ up/ down只有当用户键入的东西到输入(而不是当我在动态操控它)的工作.
这有什么解决方案吗?
几天后,我的芹菜服务将无限期地重复一项任务。这有点难以重现,但每周定期发生一次或更频繁,具体取决于正在处理的任务量。
我将感谢有关如何获取有关此问题的更多数据的任何提示,因为我不知道如何跟踪它。出现时,重启celery会暂时解决。
我有一个 celery 节点运行 4 个工人(版本 3.1.23)。代理和结果后端在 Redis 上。我只发布到一个队列,我不使用 celery beat。
Django 的 setting.py 中的配置是:
BROKER_URL = 'redis://localhost:6380'
CELERY_RESULT_BACKEND = 'redis://localhost:6380'
Run Code Online (Sandbox Code Playgroud)
日志的相关部分:
[2016-05-28 10:37:21,957: INFO/MainProcess] Received task: painel.tasks.indicar_cliente[defc87bc-5dd5-4857-9e45-d2a43aeb2647]
[2016-05-28 11:37:58,005: INFO/MainProcess] Received task: painel.tasks.indicar_cliente[defc87bc-5dd5-4857-9e45-d2a43aeb2647]
[2016-05-28 13:37:59,147: INFO/MainProcess] Received task: painel.tasks.indicar_cliente[defc87bc-5dd5-4857-9e45-d2a43aeb2647]
...
[2016-05-30 09:27:47,136: INFO/MainProcess] Task painel.tasks.indicar_cliente[defc87bc-5dd5-4857-9e45-d2a43aeb2647] succeeded in 53.33468166703824s: None
[2016-05-30 09:43:08,317: INFO/MainProcess] Task painel.tasks.indicar_cliente[defc87bc-5dd5-4857-9e45-d2a43aeb2647] succeeded in 466.0324719119817s: None
[2016-05-30 09:57:25,550: INFO/MainProcess] Task painel.tasks.indicar_cliente[defc87bc-5dd5-4857-9e45-d2a43aeb2647] succeeded in 642.7634702899959s: None
Run Code Online (Sandbox Code Playgroud)
任务由用户请求发送:
tasks.indicar_cliente.delay(indicacao_db.id)
Run Code Online (Sandbox Code Playgroud)
这是任务的源代码和celery 服务配置。
为什么在服务运行一段时间后会多次收到任务?我怎样才能获得一致的行为?
我正在调整使用回调的库来使用Promises.它在我使用时then()起作用,但在我使用时它不起作用await.
> dbc.solve
[AsyncFunction]
> await dbc.solve(img)
await dbc.solve(img)
^^^^^
SyntaxError: await is only valid in async function
Run Code Online (Sandbox Code Playgroud)
dbc.solve的代码是:
module.exports = DeathByCaptcha = (function() {
function DeathByCaptcha(username, password, endpoint) {
...
}
DeathByCaptcha.prototype.solve = async function(img) {
return new Promise(
function(resolve, reject) {
...
}
);
};
})();
Run Code Online (Sandbox Code Playgroud)
我相信这有事实solve是成员prototype,但我找不到任何有关它的信息.我发现节点并不总是支持异步等待类方法,所以我从节点7升级,现在我正在使用节点9.4.0.
javascript ×2
async-await ×1
celery ×1
celery-task ×1
css3 ×1
flexbox ×1
forms ×1
jquery ×1
nginx ×1
onchange ×1
php ×1
promise ×1
python ×1
vue.js ×1