我如何在vuejs方法中使用settimeout()函数?
我已经尝试过这样的东西,但它不起作用
fetchHole: function () {
//get data
},
addHole: function () {
//my query add new
setTimeout(function () { this.fetchHole() }, 1000)
},
Run Code Online (Sandbox Code Playgroud)
我收到此错误消息: Uncaught TypeError: this.fetchHole is not a function
我有一个课程有两个重要的功能:
public class Foo {
//plenty of properties here
void DoSomeThing(){/*code to calculate results*/}
void SaveSomething(){/* code to save the results in DB*/}
}
Run Code Online (Sandbox Code Playgroud)
SaveSomething()使用计算结果 DoSomeThing().
问题是我们不能在SaveSomething()之前打电话DoSomeThing()或如果发生这种情况,结果不是真实的结果.我的意思是调用顺序很重要,这是维护代码的一个问题.(当新的一个被添加到团队中时).
有没有办法管理这个?
我想到如下3种方法
SaveSomething()如果它之前调用过,则抛出异常DoSomeThing()具有bool被设置在DoSomeThing()和SaveSomething()代码改变为:
bool resultsAreCalculated = false;
void SaveSomething(){
if (!resultsAreCalculated) {
DoSomeThing();
// the resultsAreCalculated = true; is set in DoSomeThing();
// can we throw some exception?
}
/* code to save the results in DB*/
} …Run Code Online (Sandbox Code Playgroud)我们有一个基于spicIE的IE插件,目的是连接到一些外部设备.
为了连接这些外部设备,另一家公司开发了他们的令牌和DLL.我们需要有一些ActiveX和DLL来通过令牌进行身份验证.
问题是我们为IE开发的插件,最后一部分有一个install.bat文件,它运行一个RegAsm并注册DLL,然后在IE中查看该插件(或其更改).
从IE运行插件时,我们的代码找不到一些身份验证所需的DLL(将其命名为x.dll).注册的DLL在哪里复制?真的被复制了吗?我需要在我的插件的DLL存在的文件夹中有x.dll.
我generic repository在ef5应用程序中使用pattren .有一种create()方法IDbSet,在ef7 DbSet中不存在.
Create()EF5 中方法的描述如下:
为此集的类型创建实体的新实例.请注意,此实例未添加或附加到集合.如果基础上下文配置为创建代理并且实体类型满足创建代理的要求,则返回的实例将是代理.
代码示例:
public interface IRepository<T> where T : IDisposable {
T Create();
}
public class Repository<T> : IRepository<T> where T : IDisposable {
protected IUnitOfWork uow;
protected IDbSet<T> entity;
public Repository(IUnitOfWork uow) {
this.uow = uow;
this.entity = uow.Set<T>();
}
public T Create() {
return entity.Create();
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,为什么 Create();在EF7中删除了方法DbSet(IDbSet在EF核心中也删除了注意事项)
我发现了这个问题:Create()和新的T(),如果我使用新的T(),将来有什么问题吗?
我有以下html和CSS.但我无法弄清楚的是如何在主div的右侧设置标签div.所以他们像书签一样伸出正确的位置.
.main {
-moz-border-radius:10px;
height: 75%;
width: 60%;
position: absolute;
top: 15%;
left: 20%;
right: auto;
}
.tabs {
width: 50px;
height: 1.3em;
position: absolute;
float: right;
}
#tab { margin: 10px 10px 10px 0px;}
Run Code Online (Sandbox Code Playgroud)
和HTML:
<div class="main">
<div id="content">
Some main content
</div>
</div>
<div class="tabs">
<div class="tabs" id="tab1">
<a href="#" alt="Home">
Home
</a>
</div>
<div class="tabs" id="tab2">
<a href="#" alt="About">
About
</a>
</div>
</div>
Run Code Online (Sandbox Code Playgroud) 我在这个地址使用vue-cli webpack样板:
我希望webpack不要在开发模式下缩小和打包js文件.如何实现?问题是我们有一个巨大的测试asp.net webforms应用程序,它已经包含jquery和bootstrap,以一种无法绕过的方式.我与vue有冲突的jquery和bootstrap.js.我无法在开发模式下调试它们.
我有一个简单的WebApi项目,该项目IdentityServer4.AccessTokenValidation用于验证IdentityServer4服务器在开发地址处发出的令牌:https://localhost:44347
我通过将以下数据发送到Identityserver获得令牌:
POST
https://localhost:44347/connect/token
client_id:x.api.client
client_secret:secret
response_type:code id_token
scope:X.api
grant_type:client_credentials
Run Code Online (Sandbox Code Playgroud)
响应是:
{
"access_token": "THETOKEN",
"expires_in": 1209600,
"token_type": "Bearer"
}
Run Code Online (Sandbox Code Playgroud)
并将令牌发送到WebAPi
POST
http://localhost:59062/identity
Authorization:Bearer THETOKEN
Run Code Online (Sandbox Code Playgroud)
我得到了所需的结果,但是添加了以下代码结果404 Not Found的注释部分。
代码是:
public class Startup {
private const string API_NAME = "X.api";
public Startup(IConfiguration configuration) {
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services) {
string connectionString = Configuration.GetConnectionString("DefaultConnection");
services.AddLogging(configure => configure.AddConsole());
services.AddDbContext<MyDataContext>(options => options.UseSqlServer(connectionString));
services.AddMvcCore()
.AddAuthorization()
.AddJsonFormatters()
.SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddTransient<IUserStore<MyUser>, MyUserStore>();
services.AddTransient<IRoleStore<MyRole>, RoleStore>(); …Run Code Online (Sandbox Code Playgroud) c# asp.net-identity .net-core identityserver4 asp.net-core-webapi
我需要向用户显示一个消息框,是没有选项,但不是暂停我的功能的过程,这是一个冗长的功能,需要一分钟左右才能完成.messagebox的任务是要求用户继续或不继续.如果用户单击是,则不会发生任何特殊情况,工作将继续完成,如果用户未单击任何按钮,则进程必须执行该任务,并且完成后,消息框必须消失,但如果用户单击否,则函数必须退出.(比如计算时的计算器,例如10000000!).
c# ×5
vue.js ×2
.net-core ×1
css ×1
dll ×1
html ×1
ie-plugins ×1
javascript ×1
jquery ×1
laravel-5 ×1
optimization ×1
php ×1
regasm ×1
webpack ×1
winforms ×1