我知道如何使用masonry.js除了vue.但是,我有问题让它运行并在vue框架内正确调用.我在创建或准备好的内部调用它,但似乎都没有正确形成网格.我怎样才能让这个在框架内工作?哦,我确实在此脚本之前的html中调用了jquery.这是组件内部的内容:
编辑:
我可以看到砌体通过使用JS指定其高度并将项目更改为绝对位置来影响网格.但是,它没有正确放置它们.它将它们堆叠在彼此上面而不是像它应该在网格中的并排侧面.

<template>
<div class="projects--container">
<div class="inner-section inner--options">
<div class="grid">
<div class="grid-item"></div>
<div class="grid-item"></div>
<div class="grid-item"></div>
</div>
</div>
</div>
</template>
<script>
export default{
ready: function () {
this.mason();
},
data: function () {
return {
options: [
{
option: 'projects',
phrase: 'for clients',
slogan: 'slogan...'
},
{
option: 'sides',
phrase: 'for us',
slogan: 'we love what we make'
},
{
option: 'moments',
phrase: 'with the crew'
}
]
}
},
methods: {
revert: function () {
this.$dispatch('return-home', …Run Code Online (Sandbox Code Playgroud) 我想我把这个简单的事情搞糊涂了。我只想获取我的密钥“周”和“天”的值。我已经尝试过以下方法:
\n\n@foreach($years as $key3 => $year)\n <h1>{{$key3}}</h1>\n @foreach($year as $key2 => $months)\n <p>{{$key2}}</p>\n @foreach($months as $key1 => $days)\n <p>{{$days[\'weeks\']}}</p>\n <p>{{$days->weeks}}</p> //try two//\n @endforeach\n @endforeach\n @endforeach\nRun Code Online (Sandbox Code Playgroud)\n\n其响应此错误:
\n\nIllegal string offset \'weeks\'\nRun Code Online (Sandbox Code Playgroud)\n\n这是我尝试循环的数组的示例:
\n\n array:4 [\xe2\x96\xbc\n 2016 => array:12 [\xe2\x96\xbc\n "01" => array:2 [\xe2\x96\xbc\n "weeks" => 5\n "days" => "31"\n ]\nRun Code Online (Sandbox Code Playgroud)\n\n有人可以帮助我理解我做错了什么吗?
\n我正在使用eloquent来查询数据库条目及其对应关系.问题是我需要将$date变量传递给关系,query如下所示:
我可以将$date变量传递给第一个查询,因为它不在with函数中.我怎样才能实现第二个目标?
询问
public static function find_task($type, $date) {
if($type == 'student') {
$mySid = Student::student_id();
$allTasks = TaskAssignment::where('student_id', $mySid)
->with('task')
->where('dueDate', $date)
->orderBy('dueDate', 'asc')
->get();
} elseif($type == 'teacher') {
$myTid = Teacher::teacher_id();
$allTasks = Tasks::where('teacher_id', $myTid)
->with(['assignment' => function ($query) {
$query->where('dueDate', $date);
$query->orderBy('dueDate', 'asc');
}])->get();
} else {
return 'error this page does not exist';
}
return $allTasks;
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Laravel 5发表一个简单的Ajax帖子。我读到Csrf令牌匹配存在问题,我可以将我的uri放入VerifyCsrfToken期望中以解决此问题。这部分起作用,但是现在我发帖时出现422错误。
我在代码中弄乱了吗?我该如何工作?这是我所拥有的:
HTML:
<div class = "q-form">
{!!Form::open(array('url' => 'questions')) !!}
<div class = "form-group">
{!! Form::hidden('user_id', $myid, ['class' => 'form-control']) !!}
{!!Form::label('title', 'Title:')!!}
{!!Form::text('title', null, ['class'=> 'form-control'])!!}
{!!Form::label('question', 'Question:')!!}
{!!Form::textarea('question', null, ['class'=> 'form-control area', 'placeholder' => 'What would you like to ask?'])!!}
{!!Form::submit('Ask!', ['class'=> 'btn btn-danger form-control ask'])!!}
</div>
{!! Form::close() !!}
</div>
Run Code Online (Sandbox Code Playgroud)
JS:
$('.ask').click(function(e) {
e.preventDefault();
var postData = $(this).serializeArray();
var base_url = 'http://rem-edu-es.eu1.frbit.net/';
$.ajax({
type: "POST",
url: base_url + "questions",
data: postData,
success: function (data) { …Run Code Online (Sandbox Code Playgroud) 堆栈溢出,
我想要完成的事情:
我想循环通过数据库找到所有(英雄)与他们的相关(访谈).我还希望每次采访都与它相关(故事)和(图像).到目前为止,我可以dd($英雄),我可以看到阵列正确地抓住每个英雄的面试,每次采访都有相关的图像和故事.如何正确循环?
错误
Invalid argument supplied for foreach() (View: /Users/plastics1509moore/Desktop/elephant_gin/resources/views/administration/index.blade.php)
Run Code Online (Sandbox Code Playgroud)
这就是我所做的:
控制器:
$heroes = Hero::with('Interview', 'Interview.stories', 'Interview.images')->orderBy('position', 'asc')->get();
Run Code Online (Sandbox Code Playgroud)
模型关系:
英雄:
public function Interview()
{
return $this->hasOne('App\Interview', 'heroInt_id');
}
Run Code Online (Sandbox Code Playgroud)
专访:
public function relationships()
{
return $this->belongsTo('App\Hero');
}
public function stories()
{
return $this->hasMany('App\InterviewStory');
}
public function images()
{
return $this->hasMany('App\InterviewImage');
}
Run Code Online (Sandbox Code Playgroud)
InterviewImage:
public function relationships()
{
return $this->belongsTo('App\Interview');
}
Run Code Online (Sandbox Code Playgroud)
InterviewStory
public function relationships()
{
return $this->belongsTo('App\Interview');
}
Run Code Online (Sandbox Code Playgroud)
HTML:
环:
@foreach($heroes as $hero)
@foreach($hero->Interview as $story)
<div>{{$story->id}}</div>
@endforeach
@endforeach
Run Code Online (Sandbox Code Playgroud) 我有所有要求Jquery,Materialize.js坐在我的Js文件上面然而我得到警告openModal不是一个函数..我检查模态名称是对的,我可以运行Materialize.toast所以我知道Materialise.js正在工作.使用按钮触发也不会调用模态.这是代码..
脚本:
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="/js/materialize.js"></script>
<script type="text/javascript" src="/js/video.js"></script>
<script src="/js/admin.js"></script>
Run Code Online (Sandbox Code Playgroud)
触发:
<button data-target="modal1" class="btn modal-trigger">Modal</button>
Run Code Online (Sandbox Code Playgroud)
莫代尔:
<!-- Modal Structure -->
<div id="modal1" class="modal">
<div class="modal-content">
<h4>Modal Header</h4>
<p>A bunch of text</p>
</div>
<div class="modal-footer">
<a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat">Agree</a>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
JS:
var modal = document.getElementById('modal1');
modal.openModal();
$('#modal1').leanModal();
$('#modal1').openModal();
Run Code Online (Sandbox Code Playgroud) 我有这个简短的 javascript,我想添加到客户的 wordpress 中。我不太了解 wordpress 的操作方式或在哪里添加我的代码。我在网上阅读了一些文章,但对如何解决这个问题有点困惑。我添加了我阅读的内容来注册脚本并告诉 wordpress 使用 Jquery,但我一直收到错误。在它没有注册它需要 jquery 之前。当我添加 wptuts_script 时,它现在无法识别。我是不是把这段代码放错了地方?这是js文件的文件路径html/wp-content/themes/metis/js基本上我想添加这个js(使用jquery):
document.ready(function() {
function wptuts_scripts_with_jquery()
{
// or
// Register the script like this for a theme:
wp_register_script( 'custom-script', get_template_directory_uri() . '/js/test.js', array( 'jquery' ));
// For either a plugin or a theme, you can then enqueue the script:
wp_enqueue_script( 'custom-script' );
}
add_action( 'wp_enqueue_scripts', 'wptuts_scripts_with_jquery' );
function updatebtm() {
var pos = $(window).scrollTop();
console.log(pos);
if (pos >= 800) {
$('.portfolio-top').css('display', 'none');
} else {
$('.portfolio-top').css('display', …Run Code Online (Sandbox Code Playgroud) javascript ×4
jquery ×4
php ×4
laravel ×3
foreach ×2
mysql ×2
ajax ×1
materialize ×1
relationship ×1
vue.js ×1
wordpress ×1