我正在开发一个需要输入负数的移动应用程序。然而,移动键盘只有[1-9.]键。有没有办法确保键盘上出现负号?我正在使用 Cordova 框架。
这是我的代码:
for (int i = 0; i < 40; i++)
{
Button btn = new Button()
{
@Override
public void click()
{
result = i;
}
};
btn.setLocation(i * 30, 0);
btn.setLabel("Option " + i);
}
Run Code Online (Sandbox Code Playgroud)
但是,由于我的button类是抽象的,i因此不能使用int,因为它没有列为final.如何在此方案中启用计数器?
谢谢.
无论出于何种原因打字稿不接受我的代码。在该UserScema.pre方法中,打字稿错误表示属性createdAt,并且password在类型 Document( this)上不存在。如何使打字稿接口应用于此方法并返回 IUserDocument 对象?
import {Schema, Model, Document, model} from 'mongoose';
import bcrypt from 'bcrypt-nodejs';
export interface IUserDocument extends Document{
createdAt: Date,
username: string,
displayName: string,
email: string,
googleId: string,
password: string,
verifyPassword(password:string): boolean
}
let UserSchema: Schema = new Schema({
createdAt:{
type:Date,
default:Date.now
},
username: {
type:String,
lowercase:true
},
displayName: String,
email: {
type:String,
lowercase:true
},
googleId: String,
password: String
});
UserSchema.pre('save', function(next){
var user = this;
if(!this.createdAt) this.createdAt = Date.now; …Run Code Online (Sandbox Code Playgroud)