我想用less来定位类中的特定元素.
在这种情况下,我想定位类的元素button,但在其中我想要定位锚标记a.
目前我有:
.button {
/* lots of bits and pieces go here, hence
the need to keep it at a class level
*/
/* further down, but still in .button */
/* Attempt 1 - fails: compiled = a .button (note the space)
a& {
height:20px;
}
/* Attempt 2 - fails: compiled = .buttona
&a {
height:20px;
}
}
Run Code Online (Sandbox Code Playgroud)
我基本上希望它编译为:
a.button
Run Code Online (Sandbox Code Playgroud)
这样我就可以创建如下元素:
<a class="button">
<button class="button">
Run Code Online (Sandbox Code Playgroud)
但是当它成为锚点时稍微改变它.我不想it's a bug in less!太早投入卡片,但如果我使用&.another-class …
我可以这样开始队列:
php artisan queue:listen
Run Code Online (Sandbox Code Playgroud)
这样可以正常工作,但我想监视队列是否正在运行,尤其重要,因为如果不是,那么似乎没有回退.
要清楚,如果我通过控制器排队电子邮件,如下:
$this->mailer->queue($view, $data, function ($message) use ($toEmail, $toName, $subject) {
$message
->to($toEmail, $toName)
->subject($subject);
});
Run Code Online (Sandbox Code Playgroud)
这将成功运行,但如果队列没有"侦听",则作业将永久地推送到作业表.
我正在寻找类似的东西 \Queue::isListening();
我正在使用v1.5组件,基本上(据我的理解扩展)最佳实践指令的包装器.
有关1.5版本组件的更多信息,请访问:http://toddmotto.com/exploring-the-angular-1-5-component-method/
我有以下内容:
<span>Correclty showing: {{ data.type }}</span>
<book class="details" type="data.type"></book>
Run Code Online (Sandbox Code Playgroud)
它的组件定义:
angular
.module('app')
.component('book', {
bindings: {
type: '='
},
template: function($element, $attrs) {
// Have tried A):
// console.log($attrs.type); // <- undefined
// And B):
$attrs.$observe('type', function(value) {
console.log(value); // <- undefined
});
// But.. C):
return "This works though {{ book.type }}"; // <- renders
}
});
Run Code Online (Sandbox Code Playgroud)
无论A)和B)变化返回undefined.C)正确渲染.
有没有办法在返回模板字符串之前访问模板函数中的属性?
Laravel 5.4+允许使用以下结构的组件:
<div class="alert alert-{{ $type }}">
<div class="alert-title">{{ $title }}</div>
{{ $slot }}
</div>
Run Code Online (Sandbox Code Playgroud)
这被称为:
@component('alert', ['type' => 'danger'])
@slot('title')
oh no
@endslot
Foo
@endcomponent
Run Code Online (Sandbox Code Playgroud)
是否有速记或刀片标记来设置传入的变量的默认值?
例如,在上面,如果我没有传入"类型",我会收到undefined variable错误.我可以这样做:
<div class="alert alert-{{ isset($type) ? $type : 'default' }}">
Run Code Online (Sandbox Code Playgroud)
但上述情况很冗长,特别是如果变量用于多个点.
给出以下代码段:
Dim s As String: s = "S:\vic\bla\[..insert more here..]\data.xml"
Debug.Print Len(s)
Debug.Print Dir(s)
Run Code Online (Sandbox Code Playgroud)
如果Len(s) >= 260我收到错误说明以下内容:
Run-time error '53':
File not found
Run Code Online (Sandbox Code Playgroud)
如果字符串小于260,它可以正常工作并显示找到和未找到文件的预期行为.
是否有DIR使用长(> 260)路径名?
笔记
文件重组不是一种选择
我在Excel 2007中运行它
Laravel自动将created_at和updated_at(从锋模型)到一个新的碳例如,如每文档.
但是,如果值是默认值,0000-00-00 00:00:00它会输出以下内容:
-0001-11-30 06:12:32对于所有0000-00-00 00:00:00值.
字段设置为时间戳类型.
我现在正在使用以下(在模型中),但是在所有可能包含默认/未设置日期的Laravel模型中执行此操作感觉很笨拙.
public function getCreatedAtAttribute($value) {
return $value == "0000-00-00 00:00:00" ? "0000-00-00 00:00:00" : $value;
}
Run Code Online (Sandbox Code Playgroud) 如果我有一个简单的过滤器,请说:
Vue.filter('foo', function (value) {
return value.replace(/foo/g, 'bar');
});
Run Code Online (Sandbox Code Playgroud)
还有一个简单的组件:
Vue.component('example', {
props: {
msg: String,
},
});
Run Code Online (Sandbox Code Playgroud)
在标记内:
<example inline-template :msg="My foo is full of foo drinks!">
{{ msg }}
</example>
Run Code Online (Sandbox Code Playgroud)
我可以简单地应用过滤器:
<example inline-template :msg="My foo is full of foo drinks!">
{{ msg | foo }}
</example>
Run Code Online (Sandbox Code Playgroud)
我可以在模板中轻松应用过滤器,但是我想将该逻辑移回组件中.
它不需要是过滤器,但基本上是为数据字段创建getter和setter的方法.
就像是:
Vue.component('example', {
props: {
msg: {
type: String,
getValue: function(value) {
return value.replace(/foo/g, 'bar');
},
}
},
});
Run Code Online (Sandbox Code Playgroud) 使用React,Redux和Thunk的组合,我有以下内容:
actions.js
import $ from 'jquery';
import * as types from '../constants/ActionTypes';
import { API_PATH } from '../constants/Config';
export function coursesLoaded(courses) {
return { type: types.COURSES_LOADED, courses };
}
export function fetchData() {
return (dispatch) => {
return $.getJSON(API_PATH).then((response) => {
dispatch(coursesLoaded(response.result));
});
};
}
Run Code Online (Sandbox Code Playgroud)
reducer.js
import { routerReducer as routing } from 'react-router-redux';
import { combineReducers } from 'redux';
import * as types from '../constants/ActionTypes';
const initialState = {
courses: [],
};
function main(state = initialState, action) {
switch(action.type) …Run Code Online (Sandbox Code Playgroud) 我正在设置一个socket.io服务器来处理套接字请求.这是在端口1234上运行.这是在laravel 5.1应用程序旁边运行.Laravel正在使用redis来处理会话.
我有很多关于使用socket.io连接laravel的教程,这一切都非常简单.我可以在套接字和laravel应用程序中连接,响应和转发消息.
但是,每个教程都避免了此设置的auth部分.一旦在套接字:1234空间内收到消息,如何在确保请求被授权的同时将该消息转发到laravel.
理想情况下,我只是简单地共享会话,并验证XSRF令牌.由于这两个应用程序位于不同的端口上,因此我无法直接接收会话.
目前我正在使用另一种方法,它涉及以下内容:
它有效,但我觉得它可能是一个安全漏洞,因为我实际上并没有使用_token来验证原点.
在React中为元素设置动画时,我们可以使用以下代码段:
<div>
<button onClick={this.handleAdd}>Add Item</button>
<ReactCSSTransitionGroup transitionName="example" transitionEnterTimeout={500} transitionLeaveTimeout={300}>
{items}
</ReactCSSTransitionGroup>
</div>
Run Code Online (Sandbox Code Playgroud)
随着赞美css动画.
我已经阅读了文档(在这里找到:https://facebook.github.io/react/docs/animation.html)但我不是100%确定两个超时属性实际上做了什么?如果动画没有完成,我会冒险猜测它们是一个后备吗?
值是否与css输入/输出持续时间值匹配,还是应该大于动画值?
.example-enter {
opacity: 0.01;
}
.example-enter.example-enter-active {
opacity: 1;
transition: opacity 500ms ease-in;
}
.example-leave {
opacity: 1;
}
.example-leave.example-leave-active {
opacity: 0.01;
transition: opacity 300ms ease-in;
}
Run Code Online (Sandbox Code Playgroud) laravel ×4
php ×3
javascript ×2
laravel-5.1 ×2
reactjs ×2
angularjs ×1
excel ×1
excel-vba ×1
laravel-4 ×1
laravel-5 ×1
laravel-5.4 ×1
less ×1
react-redux ×1
redux ×1
redux-thunk ×1
vba ×1
vue.js ×1