小编Ric*_*ick的帖子

Vue.js打字稿this。$ refs。<refField> .value不存在

用打字稿重写VueJs项目时,遇到了TypeScript错误。

这是具有自定义v模型的组件的一部分。

html中的输入字段具有一个称为“ plate”的引用,我想访问该值。该字段上的@input调用下面编写的update方法。

打字稿抱怨板上没有价值。

@Prop() value: any;

update() {
    this.$emit('input',
        plate: this.$refs.plate.value
    });
}
Run Code Online (Sandbox Code Playgroud)

模板:

<template>  
<div>
    <div class="form-group">
        <label for="inputPlate" class="col-sm-2 control-label">Plate</label>

        <div class="col-sm-10">
            <input type="text" class="form-control" id="inputPlate" ref="plate" :value="value.plate" @input="update">
        </div>
    </div>

</div>
</template>
Run Code Online (Sandbox Code Playgroud)

javascript typescript vue.js vue-component vuejs2

13
推荐指数
5
解决办法
9080
查看次数

如何将对象列表作为IHttpActionResult返回?

我是ASP.NET webapi的新手,我找不到返回id查询对象列表的方法.

这是我的GET请求的控制器方法.我想返回所有通过网址传递指定问卷的问题.

我试过这个:

// GET: api/Questions/5
[ResponseType(typeof(List<Question>))]
public Task<IHttpActionResult> GetQuestion(int questionnaireId)
{
    var questions = from q in db.Questions
    where q.QuestionnaireId == questionnaireId
    select new Question()
    {
            Id = q.Id,
            ImageLink = q.ImageLink,
            QuestionnaireId = q.QuestionnaireId,
            Text = q.Text
    };
    return questions;
}
Run Code Online (Sandbox Code Playgroud)

这是我的问题类:

public class Question
    {
        public int Id { get; set; }

        [ForeignKey("Questionnaire")]
        public int QuestionnaireId { get; set; }

        public string Text { get; set; }
        public string ImageLink { get; set; }

        public virtual …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-web-api

11
推荐指数
2
解决办法
2万
查看次数

读取文件:权限被拒绝

我在文件上设置了这些权限:

----r--r-x 1 rick rick       50 Nov 20 18:39 hello_world
Run Code Online (Sandbox Code Playgroud)

现在我尝试用rick组成的用户rick打开文件.

rick@ubuntu:~/Documents$ cat hello_world
cat: hello_world: Permission denied
Run Code Online (Sandbox Code Playgroud)

为什么他不能读它?

linux

4
推荐指数
2
解决办法
2万
查看次数

设置角度cli生成构建tfs

本地我的项目使用ng build --prod构建得很好,但如果我使用以下powershell脚本在tfs(团队基础服务器)上设置它,它会失败并出现一些错误.

ps脚本:

npm install
npm run ng build --prod
Run Code Online (Sandbox Code Playgroud)

tfs构建输出:

  • [1m [33m警告在./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader!./~/sass-loader!./src/scss/style .scss

  • autoprefixer:D:\ a\1\s\src\scss\style.scss:7468:3:将transition-property替换为transition,因为Autoprefixer不支持transition-property和其他transition-*@./ src的任何情况/scss/style.scss 4:14-203 2017-04-30T07:17:51.9419669Z @ multi ./~/primeng/resources/themes/bootstrap/theme.css ./~/primeng/resources/primeng.min. css ./~/font-awesome/css/font-awesome.css ./src/scss/style.scss[39m[22m

  • [错误] 0%编译10%构建模块0/1模块1活动多D:\ a\1\s\src\main.ts

  • [错误]进程已完成,退出代码为0,并且已将3个错误写入错误流.

tfs angular-cli angular

4
推荐指数
1
解决办法
7187
查看次数

如何根据自定义图表中的azure仪表板中的选定时间段计算时间粒度

在编写 kusto 查询以在我的 azure 仪表板上创建自定义图表时,我希望能够根据用户在仪表板上选择的时间段来计算时间粒度。

例如:最后 4 小时 => 时间粒度 2 分钟,最后 24 小时 => 10 分钟

我尝试了以下方法来计算该期间,因为我们仍然无法访问它(据我在互联网上可以找到的)。

let timeGrain = traces
| summarize min_time = min(timestamp), max_time = max(timestamp)
| extend timeWindow = max_time - min_time   // days / hrs/ min / seconds
| project timeWindow
| extend timeGrain = case(timeWindow <= 4h, "2m", 
                       timeWindow <= 12h, "5m", 
                       timeWindow <= 24h, "10m",
                       "2h")
                       | project timeGrain;      
Run Code Online (Sandbox Code Playgroud)

该查询返回我想要实现的时间粒度,但我无法在其他查询中使用此变量。

traces
...
| summarize percentile(DurationInMs, 50) by bin(timestamp, timeGrain), CommandType
| render …
Run Code Online (Sandbox Code Playgroud)

azure azure-application-insights kql

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