小编Eem*_*Jee的帖子

如何更改 FullCalendar 中所选日期的背景颜色

我正在尝试更改日历中所选日期的背景颜色。在我下面的代码中,它突出显示了所有点击日期,我如何只突出显示最后一次点击日期?

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)

javascript css fullcalendar fullcalendar-3

5
推荐指数
1
解决办法
4572
查看次数

选择多个单元格

我有这个代码,检查附件的附件大小是否大于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)

excel vba excel-vba

4
推荐指数
1
解决办法
99
查看次数

如果输入字段在 Blade.php 中具有值,如何禁用它

我正在尝试禁用输入字段(如果它有价值)。不知何故,它看起来像这样:

<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。

php disabled-input laravel-blade

4
推荐指数
1
解决办法
1万
查看次数

如何在 Vue JS &lt;td&gt; 表标签中正确使用 v-if 和 v-else

由于我的搜索是不够的我的问题,我在这里张贴有关于如何正确使用一些澄清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如果不是。

我这样做是正确的吗?我在这里需要你的指导。

html-table vue.js

3
推荐指数
1
解决办法
4684
查看次数

如何在ajax URL路由中添加变量

我正在尝试将变量连接到 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文件内。

php ajax routes laravel laravel-5

3
推荐指数
1
解决办法
3024
查看次数

如何在 laravel-validation-rules/credit-card 中获取验证消息

我按照此处的说明使用 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)

php validation credit-card laravel laravel-blade

2
推荐指数
1
解决办法
1446
查看次数

如何在Laravel中不进行认证

我目前@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)

有人对此有想法吗?

authentication laravel laravel-blade

1
推荐指数
1
解决办法
51
查看次数

如何在blade.php中使用vue获取字段的旧值

我有一个注册表,在 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 组件的输入字段中显示旧值?

php laravel vue.js laravel-blade

1
推荐指数
1
解决办法
2235
查看次数

如何从Object Array Javascript中获取唯一值

所以我有一个对象数组,如下所示:

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,amountdate有重复.这个甚至不会过滤重复的名称.

var unique = array.filter((v, i, a) =>{ return a.indexOf(v) === i});
Run Code Online (Sandbox Code Playgroud)

我怎样才能过滤重复这一个基础上name,amountdate

javascript arrays duplicates

0
推荐指数
4
解决办法
1214
查看次数

如何在 PHP 中按值对对象数组集合进行排序

所以我从数据库中得到了这个结果:

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)

php arrays sorting arraycollection

0
推荐指数
1
解决办法
2万
查看次数

如何使用空参数在Laravel Eloquent中创建whereIn查询构建器

我在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 laravel eloquent

0
推荐指数
1
解决办法
209
查看次数