我正在构建一个小应用程序,Vuejs 2.0
我有大约15个迭代元素,我想限制v-for
只有5个元素,并且可以有更多的按钮来显示整个列表.有可能吗?
我是vue js的新手,并试图学习这个.我在我的系统中安装了一个全新的vue webpack版本.我有一个css,js和这个主题模板的图像,我想要包含在HTML中,所以我尝试添加它,index.html
但我可以看到控制台中的错误,资产没有被添加.当我搜索时,我发现我可以require
在main.js
文件中使用.但是我收到了错误:
以下我在我的main.js
文件中尝试过:
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
require('./assets/styles/vendor.css');
require('./assets/styles/main.css');
require('./assets/scripts/vendor/modernizr.js');
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
template: '<App/>',
components: { App }
})
Run Code Online (Sandbox Code Playgroud)
虽然我尝试使用import来使用它,但我仍然遇到错误
// The Vue build version to load with the `import` …
Run Code Online (Sandbox Code Playgroud) 我正在努力学习vue.js. 我正在添加元素列表,我想class="active"
只添加到for循环中的第一个元素.以下是我的代码:
<div class="carousel-inner text-center " role="listbox">
<div class="item" v-for="sliderContent in sliderContents">
<h1>{{ sliderContent.title }}</h1>
<p v-html="sliderContent.paragraph"></p>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
所以第一个元素应该是这样的:
<div class="item active">
<h1>WELCOME TO CANVAS</h1>
<p>Create just what you need for your Perfect Website. Choose from a wide<br>range of Elements & simple put them on your own Canvas</p>
</div>
Run Code Online (Sandbox Code Playgroud)
我能够获取数据,所以一切都运行得很好.
以下是我的脚本代码:
<script>
export default{
data() {
return {
sliderContents: [
{
title: "WELCOME TO CANVAS",
paragraph: "Create just what you need for your Perfect Website. Choose from …
Run Code Online (Sandbox Code Playgroud) 我正在尝试在 AWS 无服务器平台上部署我的 Laravel 应用程序,我在我的 Laravel-mix 中使用动态导入和代码拆分来编译资产,要执行此操作我按照bref 包文档中的步骤安装了所需的图书馆按照指示,我还将我的公共目录与我的 s3 存储桶同步
npm run prod
aws s3 sync public/ s3://<bucket-name>/ --delete --exclude index.php
Run Code Online (Sandbox Code Playgroud)
并将我的.env
文件配置为:
MIX_ASSET_URL=https://<bucket-name>.s3.amazonaws.com
ASSET_URL=https://<bucket-name>.s3.amazonaws.com
Run Code Online (Sandbox Code Playgroud)
接下来我将我的blade
文件配置为:
<script src="{{ asset('nits-assets/js/app.js') }}"></script>
Run Code Online (Sandbox Code Playgroud)
我的webpack.mix.js
文件有:
const mix = require('laravel-mix')
const webpack = require('webpack');
const ASSET_URL = process.env.ASSET_URL + "/";
mix.js('resources/js/app.js', 'public/nits-assets/js')
.postCss('resources/sass/app.css', 'public/nits-assets/css', [
require("tailwindcss"),
])
.webpackConfig({
output: {
chunkFilename: 'nits-assets/chunks/[name].[contenthash].js',
publicPath: ASSET_URL
},
resolve: {
symlinks: false,
alias: {
NitsModels: path.resolve(__dirname, 'Models'),
},
},
plugins: [ …
Run Code Online (Sandbox Code Playgroud) 我正试着upgrade mysql
进去xamp
.我正在使用laravel
哪个需要mariaDB v10.2.2
.所以我latest msi package
从中下载了mariaDB website
.现在我按照以下几点安装相同的内容:
在这之后我尝试从控制面板启动mysql并显示以下错误:
现在,在检查错误日志时,我发现了这个:
2017-02-25 12:31:56 5736 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2017-02-25 12:31:56 5736 [Note] InnoDB: Uses event mutexes
2017-02-25 12:31:56 5736 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-02-25 12:31:56 5736 [Note] InnoDB: Number of pools: 1
2017-02-25 12:31:56 5736 [Note] InnoDB: Using generic crc32 instructions
2017-02-25 12:31:56 5736 …
Run Code Online (Sandbox Code Playgroud) 我正在尝试在XAMP中创建一个json数据库,同时使用phpmyAdmin它向我显示我正在使用mariaDB,但在我的xamp-control panel v3.2.2
显示运行中mySQL on port 3306
.我正在使用Laravel 5.4框架来创建数据库,以下是我正在尝试执行的迁移:
Schema::connection('newPortal')->create('pages', function (Blueprint $table){
$table->increments('id');
$table->string('title');
$table->string('slug')->unique()->index();
$table->json('styles')->nullable();
$table->json('content')->nullable();
$table->json('scripts')->nullable();
$table->softDeletes();
$table->timestamps();
});
Run Code Online (Sandbox Code Playgroud)
现在执行此操作时,我遇到以下错误:
SQLSTATE [42000]:语法错误或访问冲突:1064 SQL语法中有错误; 检查与您的MariaDB服务器版本对应的手册,以便在第1行使用'json null,
content
json null,scripts
json null,deleted_at
timestamp null' 附近的正确语法(SQL:create tablepages
(id
int unsigned not null auto_increment primary key,title
varchar(191) )not null,slug
varchar(191)not null,styles
json null,content
json null,scripts
json null,deleted_at
timestamp null,created_at
timestamp null,updated_at
timestamp null)默认字符集utf8mb4 collate utf8mb4_unicode_ci)
即使我保持不为null,它也会抛出相同的错误.我想要json格式的数据,我检查了支持的版本,并根据文档json格式支持从版本开始MariaDB …
我已经阅读了下面的许多文章,这些文章解释了从命名路线生成链接,但无法解决我的问题.
以下是定义的路线:
Route::get('/nitsadmin/dashboard', function () {
return view('nitsadmin.dashboard');
});
Run Code Online (Sandbox Code Playgroud)
我在锚标记中调用链接:
<a id="index" class="navbar-brand" href="{{Html::linkRoute('/nitsadmin/dashboard')}}">
<img src="../img/admin/nitseditorlogo.png" alt="Logo">
</a>
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
我有一个表,通过日期选择器以日期格式存储数据。在存储日期时我正在做这样的事情:
$data['schedule'] = Carbon::parse($request->schedule)->toDateTimeString();
Run Code Online (Sandbox Code Playgroud)
然后在模型中我定义如下:
protected $dates = [
'schedule', 'created_at', 'updated_at', 'deleted_at'
];
Run Code Online (Sandbox Code Playgroud)
现在,在检索日期时,我正在使用diffForHumans()
如下内容:
$event->schedule = $event->schedule->diffForHumans();
Run Code Online (Sandbox Code Playgroud)
但它抛出这样的错误:
找不到两位数的月份。数据缺失
我检查了 mySQL 数据库的格式,我的日期如下:
2017-07-02 14:38:23
Run Code Online (Sandbox Code Playgroud)
编辑:
之前我在将日期存储在表格中时遇到问题,请参阅如何在 laravel 中通过 Vuejs Datepicker 格式化接收日期以获取详细说明。它抛出错误:
日期时间格式无效:1292 日期时间值不正确:第 1 行“计划”列的“2017-05-04T18:30:00.000Z”
所以我选择将其存储在数据库中时使用Carbon::parse
。
怎么解决这个问题,帮帮我吧。
谢谢。
我正在构建一个小应用程序laravel 5.4
,我有两个模型Contact
,Companies
我之间有很多很多关系,在我的Contact Model:
public function company()
{
return $this
->belongsToMany('App\Company', 'company_contact','contact_id', 'company_id')->withTimestamps();
}
Run Code Online (Sandbox Code Playgroud)
现在在某个地方,我希望拥有现有公司,即我想拥有latest()
first()
.或者orderBy
,created_by
desc
并获得first()
排.为此,我必须做这样的事情:
$contacts = Contact::where('name', 'LIKE', '%'. $request->search_input. '%')
->orWhere('email', 'LIKE', '%'. $request->search_input. '%')
->orWhereHas('company', function ($q) use($request) {
$q->where('name', 'LIKE', '%'. $request->search_input. '%');
})
->with('company')
->orderBy('created_at', 'desc')
->paginate(50);
foreach ($contacts as $contact)
{
$contact->company = $contact->company()->withPivot('created_at')->orderBy('pivot_created_at', 'desc')->first();
}
Run Code Online (Sandbox Code Playgroud)
为了删除foreach
我尝试在我的Contact
模型中使用新关系:
public function currentCompany()
{
return $this
->belongsToMany('App\Company', …
Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的 Laravel 应用程序中设置电子邮件,我的 env 文件是这样的:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=noreply@xxx.com
MAIL_PASSWORD=xxx
MAIL_ENCRYPTION=tls
Run Code Online (Sandbox Code Playgroud)
我根据这个问题中给出的答案尝试了预期响应代码 250 但得到代码“535”,消息“535-5.7.8 用户名和密码不被接受
我按照步骤,启用了两步验证,然后创建了应用程序密码并配置了我的.env
文件
最后我做到了 php artisan config:cache
无法使用 3 个可能的身份验证器在用户名为“noreply@xxx.com”的 SMTP 服务器上进行身份验证。身份验证器登录返回 Swift_TransportException:预期响应代码 235,但得到代码“534”,消息为“534-5.7.14
这个你能帮我吗。谢谢。
laravel ×5
php ×4
laravel-5.4 ×3
vue.js ×3
vuejs2 ×3
mariadb ×2
webpack ×2
bref ×1
javascript ×1
json ×1
laravel-5.2 ×1
laravel-mail ×1
laravel-mix ×1
mysql ×1
mysqlupgrade ×1
php-carbon ×1
swiftmailer ×1
upgrade ×1
xampp ×1