我正在尝试更改日历中所选日期的背景颜色。在我下面的代码中,它突出显示了所有点击日期,我如何只突出显示最后一次点击日期?
dayClick: function (day){
var mydate = new Date(this[0].getAttribute("data-date"));
var dateArray = mydate.toDateString().split(" ");
document.querySelectorAll(".calendar-mobile p")[0].innerHTML = j_monthNames[mydate.getMonth()] + " " + mydate.getDate() + "?" + "(" + j_dayNames[dateArray[0].toLocaleLowerCase()] + ")";
document.body.classList.remove("calendar-open");
$month = '' + (mydate.getMonth() + 1);
$day = '' + mydate.getDate();
$year = mydate.getFullYear();
if ($month.length < 2) $month = '0' + $month;
if ($day.length < 2) $day = '0' + $day;
$dates = [$year, $month, $day].join('-');
$('[data-date='+$dates+']').css({"color": "red", "backgroundColor": "yellow",});
},
Run Code Online (Sandbox Code Playgroud) 我有这个代码,检查附件的附件大小是否大于10MB.现在,如果附件大于10MB,它会显示文件名,msgbox然后我想选择或突出显示此附件大于10 MB的单元格但不知道如何操作.
这是我尝试过的:
Function checkAttSize()
Application.ScreenUpdating = False
Dim attach As Object
Dim attSize() As String
Dim loc() As String
Dim num As Long
Dim rng As Range
Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.CreateItem(0)
Set main = ThisWorkbook.Sheets("Main")
lRow = Cells(Rows.count, 15).End(xlUp).Row
efCount = 0
num = 0
With objMail
If lRow > 22 Then
On Error GoTo errHandler
For i = 23 To lRow
'attach.Add main.Range("O" & i).value
'totalSize = totalSize +
If (FileLen(main.Cells(i, "O").value) …Run Code Online (Sandbox Code Playgroud) 我正在尝试禁用输入字段(如果它有价值)。不知何故,它看起来像这样:
<input type="text" name="sex" value="{{ old('sex', $user['sex']) }}" placeholder="">
Run Code Online (Sandbox Code Playgroud)
我尝试添加如下:
<input type="text" name="sex" value="{{ old('sex', $user['sex']) }}"
disabled= {{ $user['sex'] == null ? disabled :'' }} >
Run Code Online (Sandbox Code Playgroud)
但它不起作用。顺便说一句,我正在使用blade.php。
由于我的搜索是不够的我的问题,我在这里张贴有关于如何正确使用一些澄清v-if,并v-else在<td>在VUE在HTML表格标记。
//given the value of this.property is name
<tr>
<td v-if="this.property == 'name'">I'm name</td>
<td v-else>No I'm not</td>
</tr>
Run Code Online (Sandbox Code Playgroud)
我的问题是,即使我的this.property值是'name'或不是a'name'它总是符合v-else条件,并且v-if不会被执行。我想要的输出是执行v-if如果this.property值是'name',v-else如果不是。
我这样做是正确的吗?我在这里需要你的指导。
我正在尝试将变量连接到 ajax 中的 url 链接。该变量$news是处理通知 ID 的变量。
$(document).on("click", "#viewList", function() {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
var $news = $(this).prop("value");
$.ajax({
type: "get",
url : '{{url("admin/recipients/", $news)}}', //returning an error undefined variable news
data: {newsID : $news},
success: function(store) {
console.log(store);
$('#rec').text(store);
},
error: function() {
$('.alert').html('Error occured. Please try again.');
}
});
});
Run Code Online (Sandbox Code Playgroud)
在我的 web.php 中,它的路由位于路由组内。
Route::group(['middleware' => 'auth:admin'], function () {
Route::prefix('admin')->group(function() {
Route::get('/recipients/{news}', 'Admin\NewsController@recipients');
});
});
Run Code Online (Sandbox Code Playgroud)
那么我怎样才能做到这一点呢?顺便说一下,我的ajax在一个blade.php文件内。
我按照此处的说明使用 laravel 验证器获取信用卡信息。我终于可以让它工作了,但我的问题是如何让用户可以读取它的结果。我也像这样使用 Laravel 验证:
public static function validate()
{
$val = [
'card_num' => ['required', 'numeric', new CardNumber],
];
return $val;
}
Run Code Online (Sandbox Code Playgroud)
因此,如果我单击提交按钮并且该字段为空,则结果是card num??????这意味着需要卡号。如果我提供了一个无效的卡号,结果是validation.credit_card.card_length_invalid,我怎样才能使它具有与将该字段留空相同的结果?在刀片 php 中获取验证错误时,我喜欢这样做。
<div>
<label>?????</label>
<input type="text" name="card_num" id="credit-card" value="{{ old('card_num', $user['card_num']) }}" >
</div>
@if ($errors->has('card_num'))
<p class="alert-error">
{{ $errors->first('card_num') }}
</p>
@endif
Run Code Online (Sandbox Code Playgroud)
更新
我看过它的源文件和消息,但我不想直接更改供应商文件。我试过添加customin validation.php,但它不起作用。
'custom' => [
'validation.card_length_invalid' => '???????',
'validation.credit_card' => '????????',
],
Run Code Online (Sandbox Code Playgroud) 我目前@auth('brand')在显示导航栏时正在使用,如果不进行身份验证,请隐藏导航栏并显示登录按钮。这是我到目前为止的内容:
@auth('brand')
//show navigations
@endauth
if not auth
Button Login
end not auth
Run Code Online (Sandbox Code Playgroud)
试过
if(!@auth('brand'))
//show navigations
@endif
//but this is not working, it's showing the nav bar and the log in button
Run Code Online (Sandbox Code Playgroud)
有人对此有想法吗?
我有一个注册表,在 Laravel 刀片文件中使用 vue。我正在对用户的无效输入使用验证器,我想获取该字段的旧值,但现在我无法使其工作,因为某些字段正在使用 vue。这是我的代码:
注册表.blade.php
<div class="regist_input">
<input type="email" name="email" v-model="email" v-bind:placeholder="placeholder_email" v-bind:class="{ error: emailError }">
<p class="error_text" v-bind:class="{ active: emailError2 }">Invalid email.</p>
@if($errors->has('email'))
<p class="alert-error">
{{ $errors->first('email') }}
</p>
@endif
</div>
<dd>
<div class="regist_input">
<input class="input_company" type="text" name="company" value="{{ old('company') }}" placeholder="company"> //this one works
</div>
</dd>
Run Code Online (Sandbox Code Playgroud)
控制器
if($validator->fails()) {
return redirect()->back()->withInput()->withErrors($validator->errors());
}
Run Code Online (Sandbox Code Playgroud)
如果在字段之外,我可以显示其旧值,这意味着我的验证 php 函数正在运行。
我尝试使用v-bind:value="{{ old('email') }}"或:value="{{ old('email') }}"但不起作用。对于这个,如何在具有 vue 组件的输入字段中显示旧值?
所以我有一个对象数组,如下所示:
var array = [
{name:"Joe", date:'2018-07-01', amt:250 },
{name:"Mars", date:'2018-07-01', amt:250 },
{name:"Joe", date:'2018-07-02', amt:250 },
{name:"Saturn", date:'2018-07-01', amt:250 },
{name:"Joe", date:'2018-07-02', amt:250 },
{name:"Jupiter", date:'2018-07-01', amt:250 },
]
Run Code Online (Sandbox Code Playgroud)
我想这取决于如果过滤数据name,amount并date有重复.这个甚至不会过滤重复的名称.
var unique = array.filter((v, i, a) =>{ return a.indexOf(v) === i});
Run Code Online (Sandbox Code Playgroud)
我怎样才能过滤重复这一个基础上name,amount和date?
所以我从数据库中得到了这个结果:
object(Illuminate\Support\Collection)#538 (1) {
["items":protected]=>
array(3) {
[0]=>
object(stdClass)#536 (3) {
["col_header"]=>
string(7) "other_1"
["col_order"]=>
int(12)
["data"]=>
string(13) "asdgasdgfasdg"
}
[1]=>
object(stdClass)#545 (3) {
["col_header"]=>
string(7) "other_2"
["col_order"]=>
int(10)
["data"]=>
string(10) "dfhgsdhgsd"
}
[2]=>
object(stdClass)#533 (3) {
["col_header"]=>
string(7) "other_3"
["col_order"]=>
int(11)
["data"]=>
string(1) "s"
}
}
Run Code Online (Sandbox Code Playgroud)
现在,我如何根据 的值对其结果进行排序col_order?结果应该是这样的:
object(Illuminate\Support\Collection)#538 (1) {
["items":protected]=>
array(3) {
[0]=>
object(stdClass)#545 (3) {
["col_header"]=>
string(7) "other_2"
["col_order"]=>
int(10)
["data"]=>
string(10) "dfhgsdhgsd"
}
[1]=>
object(stdClass)#533 (3) {
["col_header"]=>
string(7) "other_3"
["col_order"]=>
int(11)
["data"]=> …Run Code Online (Sandbox Code Playgroud) 我在Laravel Eloquent中进行了查询以在表格中搜索.
public function searchContest($search){
$category = [];
$area = [];
if(isset($search['area'])){
$area = $search['area'];
}
if(isset($search['category'])){
$category = $search['category'];
}
$qry = self::whereIn('area',$area)
->whereIn('category', $category)
->get();
var_dump($query);
return;
}
Run Code Online (Sandbox Code Playgroud)
但有时,area或者category是空的,whereIn不适用它.我无法在网上找到任何有效的解决方案.我该怎么做这样的查询?
php ×6
laravel ×5
arrays ×2
javascript ×2
vue.js ×2
ajax ×1
credit-card ×1
css ×1
duplicates ×1
eloquent ×1
excel ×1
excel-vba ×1
fullcalendar ×1
html-table ×1
laravel-5 ×1
routes ×1
sorting ×1
validation ×1
vba ×1