小编Vin*_*nce的帖子

使用OBJMTLLoader加载Access Object3D

我正在构建一个允许用户以obj/mtl格式上传3D模型的应用程序.管理员在我们的查看器中显示已加载对象的外观预览.我想为用户提供控件,以设置加载对象的初始y位置和相机的初始z位置.我有相机部件,但我对y位置没有运气.我的代码:

var obj3d;

loader.load( model_obj, model_mtl, function ( object ) {
    object.position.y = y_init;
    scene.add( object );
    render();

    obj3d = object;

    $('#initial_y').change(function() {
      obj3d.position.y = $(this).val();
    });

}, onProgress, onError );
Run Code Online (Sandbox Code Playgroud)

问题似乎是,一旦我在load函数之外,对该函数的引用就Object3D不再可用了.上面的代码给出了一个javascript错误:

Cannot access property 'position' of undefined.
Run Code Online (Sandbox Code Playgroud)

任何帮助是极大的赞赏!

javascript three.js

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

Vue.js prop 同步修饰符不更新父组件

我有一个属性需要传递给子组件,但子组件需要能够修改传递的值。似乎.sync修改器是为此构建的,但我似乎无法让它工作。这是我的代码(针对这个问题进行了简化):

\n

配置文件.vue

\n
<template>\n  <div>\n    <Avatar :editing.sync="editing"></Avatar>\n    <a href="" @click.prevent="changeAvatar">click to change</a>\n    ...\n  </div>\n</template>\n\n<script>\nimport Avatar from \'./profile/Avatar\'\n\nexport default {\n  components: { Avatar },\n  data() {\n    return {\n      ...,\n      editing: false,\n    }\n  },\n  methods: {\n    editAvatar() {\n      this.editing = true;\n    }\n  }\n}\n</script>\n\n
Run Code Online (Sandbox Code Playgroud)\n

阿凡达.vue

\n
<template>\n  <div>\n    <template v-if="!editing">\n      <img class="avatar-preview" :src="avatar">\n    </template>\n    <template v-else>\n      <label v-for="image in avatars">\n        <img class="avatar-thumb" :src="image">\n        <input type="radio" name="avatar" :checked="avatar === image">\n      </label>\n      <button class="btn btn-primary">Save</button>\n    </template>\n  </div>\n</template>\n\n<script>\nexport default {\n  props: [\'editing\'],\n …
Run Code Online (Sandbox Code Playgroud)

avatar vue.js

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

Laravel控制器认为我的功能未定义

很简单.我正试图从我的控制器中调用一个函数.事实上,该功能已定义.然而,当调用该函数时,我得到"PHP致命错误:调用未定义函数validate()..."

这是我的代码.有任何想法吗?谢谢.

<?php

class HomeController extends BaseController {

    /**
     * Controller for the index action of the home page.  Displays the landing page.
     */
    public function index()
    {
        return View::make('landing', array('success' => false));
    }

    /**
     * Controller to handle processing the contact form and re-displaying the landing page
     */
    public function processForm()
    {
        $form_array = array();
        $errors = array();

        foreach (array('email','fname','lname','message','newsletter') as $val)
        {
            if (isset($_POST[$val]))
                $form_array[$val] = $_POST[$val];
            else
                $form_array[$val] = null;
        }

        $form_ok = validate();

        if ($form_ok)
        { …
Run Code Online (Sandbox Code Playgroud)

php laravel

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

Laravel:点击标签不设置复选框

我正在使用Laravel的表单构建器来生成登录表单.这看起来很简单,但它不起作用.我正在尝试为我的复选框创建一个标签,可以单击该标签来设置/取消设置复选框.目前,单击标签不会执行任何操作.这是我的代码:

{{ Form::open(array('url' => '/account/login', 'role' => 'form')) }}
    {{ Form::token() }}
    <div class="form-group">
        {{ Form::label('email', 'Email Address', array('class' => 'sr-only')) }}
        {{ Form::text('email', '', array('class' => 'form-control', 'placeholder' => 'Email Address')) }}
    </div>
    <div class="form-group">
        {{ Form::label('password', 'Password', array('class' => 'sr-only')) }}
        {{ Form::password('password', array('class' => 'form-control', 'placeholder' => 'Password')) }}
    </div>
    {{ Form::submit('Login', array('class' => 'btn btn-default')) }}
    <a href="#forgotpassword" class="btn btn-link btn-sm pull-right">Forgot password?</button></a><br>
    {{ Form::checkbox('remember') }}
    {{ Form::label('remember', 'Remember me') }}
{{ Form:: close() }}
Run Code Online (Sandbox Code Playgroud)

我不确定问题是什么,但我可能错过了一些明显的问题.任何帮助是极大的赞赏!

checkbox formbuilder laravel

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

Laravel:使用更新的迁移将列添加到表

我正在尝试在一个迁移文件中迁移特定行。

例:

之前:

Schema::create('categories', function (Blueprint $table) {
  $table->bigIncrements('id');
  $table->string('category_name');
  $table->integer('parent_id')->nullable();
  $table->timestamps();
});
Run Code Online (Sandbox Code Playgroud)

后:

Schema::create('categories', function (Blueprint $table) {
  $table->bigIncrements('id');
  $table->string('category_name');
  $table->string('img_url'); // ? new column
  $table->integer('parent_id')->nullable();
  $table->timestamps();
});
Run Code Online (Sandbox Code Playgroud)

现在我只想迁移该行: $table->string('img_url');

可能吗?

php migration schema laravel

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