有没有人v-slot在最新的 Vuetify 版本中实现了分组行?他们的例子是这样的:
<template>
<v-data-table
:headers="headers"
:items="desserts"
item-key="name"
group-by="category"
class="elevation-1"
show-group-by
></v-data-table>
</template>
<script>
export default {
data () {
return {
headers: [
{
text: 'Dessert (100g serving)',
align: 'left',
value: 'name',
},
{ text: 'Category', value: 'category' },
],
desserts: [
{
name: 'Frozen Yogurt',
category: 'Ice cream',
},
{
name: 'Ice cream sandwich',
category: 'Ice cream',
},
{
name: 'Eclair',
category: 'Cookie',
},
{
name: 'Cupcake',
category: 'Pastry',
},
{
name: 'Gingerbread',
category: 'Cookie',
}, …Run Code Online (Sandbox Code Playgroud) 我有一个简单的Laravel 5.1代码,我得到了ErrorException Missing argument 1 for Illuminate\Support\Collection::get().这是代码:
public function boot()
{
$news = News::all()->take(5)->get();
view()->share('sideNews', $news);
}
Run Code Online (Sandbox Code Playgroud)
每当我移除->get();那里,它都有效.这是我第一次使用eloquent.我记得当我使用查询构建器时,我总是->get()在代码的最后一行添加.我做得对吗?谢谢.
所以我使用html-pdf来转换我的 html,这是我的代码:
var pdf = require('html-pdf')
var html = 'somehtmlfile.html'
pdf.create(html).toBuffer(function (err, buffer) {
if (err) {
console.log(err)
} else {
console.log(buffer)
var pdfBuffer = new Buffer(buffer)
res.setHeader('Content-disposition', 'inline; filename="test.pdf"');
res.setHeader('Content-type', 'application/pdf');
res.send(pdfBuffer)
}
}
Run Code Online (Sandbox Code Playgroud)
我没有得到任何 PDF 文件作为下载器,也没有在浏览器中输出任何 pdf 文件。这console.log(buffer)是:
<Buffer 25 50 44 46 2d 31 2e 34 0a 31 20 30 20 6f 62 6a 0a 3c 3c 0a 2f 54 69 74 6c 65 20 28 fe ff 29 0a 2f 43 72 …Run Code Online (Sandbox Code Playgroud) 假设我有一群用户。
const users = [
{ id: 1, name: 'Cena John' },
{ id: 2, name: 'Marcus Ignacious' }
];
Run Code Online (Sandbox Code Playgroud)
是的,该users变量不可重新分配。但是如果我向其中添加一些数据呢?
users.push({id: 3, name: 'Kanye South'});
Run Code Online (Sandbox Code Playgroud)
我知道 的值users没有改变,只是它里面的值改变了。
我想知道是否有任何约定在涉及数组时更喜欢 let 而不是 const 。
我的一位同事说我应该使用,let因为值已更新。
最好使用哪一种?
所以我有这个输出:
这是我的控制器中的代码:
public function showToday()
{
$now = new DateTime('today');
$today = $now->format('Y-m-d');
$reservations = Reservation::with('room') ->where('reservation_from', $now)
->orderBy('created_at')
->get();
return \View::make('pages.admin.report.today') -> with('reservations', $reservations)
-> with('now', $today);
}
Run Code Online (Sandbox Code Playgroud)
架构:
视图(刀片)
<div class="box-body table-responsive no-padding">
<table class="table table-bordered">
<thead>
<tr>
<th>Room #</th>
<th>Reservation From</th>
<th>Reservation To</th>
<th>Booked At</th>
<th>Amount</th>
</thead>
</tr>
<tbody>
@foreach($reservations as $res)
<tr>
<td>{{ $res -> room -> room_number }}</td>
<td>{{ date('F d, Y', strtotime($res -> reservation_from)) }}</td>
<td>{{ date('F d, Y', strtotime($res -> reservation_to)) }}</td>
<td>{{ …Run Code Online (Sandbox Code Playgroud) 我使用的Slim Framework一起Laravel's Eloquent ORM,这是我的代码:
user.php的
class User extends \Illuminate\Database\Eloquent\Model
{
protected $table = 'accounts';
}
Run Code Online (Sandbox Code Playgroud)
的index.php
require_once 'vendor/autoload.php';
// Models
include 'app/models/User.php';
$app = new \Slim\Slim();
// Database information
$settings = array(
'driver' => 'mysql',
'host' => '127.0.0.1',
'database' => 'photo_mgmt',
'username' => 'root',
'password' => '',
'collation' => 'utf8_general_ci',
'prefix' => '',
'charset' => 'utf8',
);
$container = new Illuminate\Container\Container;
$connFactory = new \Illuminate\Database\Connectors\ConnectionFactory($container);
$conn = $connFactory->make($settings);
$resolver = new \Illuminate\Database\ConnectionResolver();
$resolver->addConnection('default', $conn);
$resolver->setDefaultConnection('default');
\Illuminate\Database\Eloquent\Model::setConnectionResolver($resolver); …Run Code Online (Sandbox Code Playgroud) 今天是个好日子!
我在这里有一个带有slim-basic-auth的工作超薄代码,当我转到受限目录时,会显示:
一切正常,但我想要做的是将其重定向到我的登录页面,而不是显示弹出登录框。这是我的登录页面:
我的苗条代码:
$pdo = new \PDO("mysql:host=localhost;dbname=databasename", "username");
$app->add(new \Slim\Middleware\HttpBasicAuthentication([
"path" => "/main",
"realm" => "Protected",
"authenticator" => new PdoAuthenticator([
"pdo" => $pdo,
"table" => "accounts",
"user" => "accountUsername",
"hash" => "accountPassword"
]),
"callback" => function ($request, $response, $arguments) use ($app) {
return $response->withRedirect('/main/contacts');
}
Run Code Online (Sandbox Code Playgroud)
当我尝试使用弹出登录框登录时,它可以工作,但我真的想将它重定向到我的登录页面而不是那个页面。
任何帮助将非常感激。
我正在使用Vue,突然一些使用vuetify的计算css 无效.
我声明一个对象的方式是
personal_info : {}
Run Code Online (Sandbox Code Playgroud)
在我的模板中,我可以personal_info.name在每个文本输入的v模型中做更多的事情.
我没有错误,但突然vuetify有一个叫做的类input-group--dirty,只要文本输入不是空的,它就会提升文本输入的标签.但突然间,它没有用.它看起来像这样:
如您所见,文本和标签重叠.
唯一能使它工作的是将属性设置为null,即:
personal_info : {
name: null
}
Run Code Online (Sandbox Code Playgroud)
问题是我有数百个文本输入,我不想将所有内容都设置为null.
有没有一种简单的方法将所有对象的属性设置为null而不是逐个编码?
我有2个文件:
.env
docker-compose.yml
Run Code Online (Sandbox Code Playgroud)
docker-compose.yml 看起来像这样:
version: '3'
services:
database:
image: mysql:5.7
myapp:
image: me/some-image
depends_on:
- database
env_file: .env
Run Code Online (Sandbox Code Playgroud)
myapp 是一个 Web 服务应用程序,需要 .env 文件,或者如果不存在 .env 文件,它可以选择访问环境变量。
截至目前, myapp 正在访问环境变量,因为出于安全原因我不希望 .env 文件包含在映像构建中。我所做的是将 a 传递env_file: .env给文件中的 myapp 服务docker-compose.yml,以便它将依赖于服务的环境变量而不是 .env 文件。
现在,我真的想在运行时向 myapp 服务添加一个 .env 文件docker-compose up。请注意,如果 myapp Web 服务未找到 .env 文件,则会抛出错误,并且选项是查找 .env 文件,而不是从容器的环境变量中获取。
有没有办法在运行时创建 .env 文件docker-compose up并在主机上复制 .env 文件的内容?先感谢您。
我在组中获取路线时遇到问题.这是我的代码:
Route::group(['prefix' => 'commodities'], function(){
Route::get('commodities', [
'as' => 'showCommodities', 'uses' => 'CommodityController@showAll'
]);
Route::get('{id}', [
'as' => 'showCommodity', 'uses' => 'CommodityController@show'
]);
Route::get('add', [
'as' => 'addCommodity', 'uses' => 'CommodityController@create'
]);
Route::post('update', [
'as' => 'updateCommodity', 'uses' => 'CommodityController@update'
]);
Route::post('destroy', [
'as' => 'destroyCommodity', 'uses' => 'CommodityController@destroy'
]);
Route::post('add', [
'as' => 'storeCommodity', 'uses' => 'CommodityController@store'
]);
});
Run Code Online (Sandbox Code Playgroud)
我在CommodityController这里粘贴了代码http://pastebin.com/bWrdVhsv
一切都有效,除了GET路线commodites/add.我总是得到一个白页.我的调试设置为TRUE,我有正确的刀片.
我在这里错过了什么吗?