小编Kee*_*ert的帖子

如何确保移动设备上输入 HTML 数字时键盘有负号键?

我正在开发一个需要输入负数的移动应用程序。然而,移动键盘只有[1-9.]键。有没有办法确保键盘上出现负号?我正在使用 Cordova 框架。

html javascript input cordova

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

如何使用计数器创建多个抽象实例?

这是我的代码:

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.如何在此方案中启用计数器?

谢谢.

java scope

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

使用猫鼬模型设置打字稿

无论出于何种原因打字稿不接受我的代码。在该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)

javascript mongoose typescript

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

标签 统计

javascript ×2

cordova ×1

html ×1

input ×1

java ×1

mongoose ×1

scope ×1

typescript ×1