提交表单后,我无法在纸张输入容器内重置标签.表单是一个简单的登录表单.如果用户在没有页面刷新(从浏览器)的情况下再次登录,注销和重新登录,则标签似乎卡住,就好像输入中有值一样.
这是一张显示差异的图片:

这是元素内部的形式:
<form is="iron-form">
<paper-input-container id="email_container">
<paper-input-error>E-mail or Password is incorrect</paper-input-error>
<label>E-Mail Address</label>
<input is="iron-input" id="email" on-blur="validateEmail" value="{{emailInput::input}}">
</paper-input-container>
<paper-input-container id="password_container">
<label>Password</label>
<input is="iron-input" id="password" type="password" value="{{passwordInput::input}}">
</paper-input-container>
<paper-button raised dialog-dismiss>Cancel</paper-button>
<paper-button raised on-tap="handleCsrf">Login</paper-button>
</form>
Run Code Online (Sandbox Code Playgroud)
这两种方法都使形式到"登录后"状态相同:
//
this.emailInput = null;
this.passwordInput = null;
//
this.emailInput = "";
this.passwordInput = "";
Run Code Online (Sandbox Code Playgroud)
我认为这会以某种方式重置整个容器,但它什么都不做:
this.$.email_container = null;
this.$.password_container = null;
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个基本的Phong灯光着色器,以了解着色器中的灯光.另外,我正在使用openframeworks.我创造了3个立方体,它们围绕它们旋转.照明似乎正在起作用(sorta),但是立方体具有不必要的透明度,您可以在此处看到:

这是我的代码,它基于本教程
testApp.h
#pragma once
#include "ofMain.h"
class testApp : public ofBaseApp{
public:
ofCamera camera;
ofLight pointLight;
float camAngle;
float camX;
float camY;
float camZ;
ofShader lightShader;
ofBoxPrimitive box1;
ofBoxPrimitive box2;
ofBoxPrimitive box3;
void setup();
void update();
void draw();
};
Run Code Online (Sandbox Code Playgroud)
testApp.cpp
#include "testApp.h"
//--------------------------------------------------------------
void testApp::setup()
{
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
ofBackground(100, 100, 100);
ofSetFrameRate(30);
camera.setNearClip(0.1);
camera.setFarClip(1200);
camAngle = 0;
camX = 200;
camY = 150;
camZ = 200;
pointLight.setPointLight();
lightShader.load("shaders/lightShader");
//boxes setup here, not necessary to show
}
//--------------------------------------------------------------
void …Run Code Online (Sandbox Code Playgroud) 我正在开发一个openFrameworks项目,我正在使用它vector来存储3d网格索引位置.但是,在尝试访问数据时,我得到:
Run Code Online (Sandbox Code Playgroud)error: no match for 'operator []' in ((icoSphere*)this)->icoSphere::subIndicies[i]
数据类型是ofIndexType.
这是一些片段
icoSphere.h文件:
// vector created
std::vector<ofIndexType> subIndicies;
Run Code Online (Sandbox Code Playgroud)
icoSphere.cpp文件:
// items added to vector
ofIndexType indA = mesh.getIndex(0);
ofIndexType indB = mesh.getIndex(1);
ofIndexType indC = mesh.getIndex(2);
subIndicies.push_back(indA);
subIndicies.push_back(indB);
subIndicies.push_back(indC);
// iterate through vector
for (std::vector<ofIndexType>::iterator i = subIndicies.begin(); i !=subIndicies.end(); i++)
{
subMesh.addIndex(subIndicies[i]); // here is where the error occurs
}
Run Code Online (Sandbox Code Playgroud)
向量和迭代器都是ofIndexType(openFrameworks数据类型,本质上是无符号整数).无法理清为什么它说[]不是运营商.
部署我的第一个应用引擎应用程序后,我Static file referenced by handler not found: index.html在日志中收到错误消息。这是我的 yaml 文件:
application: section-14
version: v1
api_version: 1
runtime: python27
threadsafe: yes
handlers:
- url: /bower_components
static_dir: bower_components
- url: /general
static_dir: general
- url: /projects
static_dir: projects
- url: /js
static_dir: js
- url: /styles
static_dir: styles
- url: /elements
static_dir: elements
- url: /images
static_dir: images
#here's the problem
- url: /
static_files: index.html
upload: /
#------------------
- url: /elements.html
static_files: elements.html
upload: /
Run Code Online (Sandbox Code Playgroud)
我可以毫无问题地访问任何其他目录和位于这些目录中的文件。此外,如果您查看index条目下方,该elements.html …
我正在编写一个使用Polymer 1.0的辅助函数加载html文件的简单元素importHref().页面加载,但不是html呈现到页面,我得到[object HTMLDocument].
当我记录成功的回调时,导入的页面被包装在一个#document对象中(这里的术语不确定).但是,信息就在控制台中.
所以,我的问题是:如何将html呈现给页面?
元件:
<dom-module id="content-loader">
<template>
<span>{{fileContent}}</span>
</template>
<script>
Polymer({
is: "content-loader",
properties: {
filePath: {
type: String
}
},
ready: function() {
this.loadFile();
},
loadFile: function() {
var baseUrl;
if (!window.location.origin)
{
baseUrl = window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');
}
else
{
baseUrl = window.location.origin;
}
//import html document and assign to fileContent
if(this.filePath)
{
this.importHref(baseUrl + this.filePath, function(file){
this.fileContent = …Run Code Online (Sandbox Code Playgroud) 我正在编写一个从JSON对象递归构建菜单树的元素.但是,当函数调用自身时,我得到错误:this.buildMenu is not a function
这是buildMenu
buildMenu: function(items) {
var node = new Array();
items.forEach(function(elem,index,arr) {
node.push(elem.Name);
if (elem.SubBranch.length > 0) {
return this.buildMenu(elem.SubBranch); //error is here
}
});
return node;
}
Run Code Online (Sandbox Code Playgroud)
调用buildMenu的原始方法
handleRes: function() {
this.response = this.$.categoryList.lastResponse;
this.menuItems = this.buildMenu(this.response);
//...
}
Run Code Online (Sandbox Code Playgroud)
我已经验证数据是否存在且格式正确.如果我注释掉递归调用,我会得到第一层结果.所以,它正在这方面工作.
elem.SubBranch在递归调用中调用的参数是一个数组,如果重要的话,它是完全有效的.
我正在创建一个具有多个动画方法的类的应用程序.我需要以随机的方式调用这些动画方法.所以,我的想法是创建一个void函数指针的向量,并遍历向量.我不能让它编译.我收到了错误:"invalid use of void expression".
适用代码:
.H
std::vector<void(*)(int,float)> animationsVector;
void setAnimations();
void circleAnimation01(int circleGroup, float time);
Run Code Online (Sandbox Code Playgroud)
的.cpp
polygonCluster01::polygonCluster01()
{
setAnimations();
}
void polygonCluster01::setAnimations()
{
animationsVector.push_back(circleAnimation01(1,2.0)); //error is here
}
void polygonCluster01::circleAnimation01(int circleGroup, float animLength)
{
//other code
}
Run Code Online (Sandbox Code Playgroud)
我已经关注了其他一些帖子,这些帖子表明我做得对,但它仍然无法编译,我不知道为什么.