小编Jin*_*nov的帖子

当 v-for 与对象的属性一起使用时,使用带有复选框的 v-model

与对象数组一起使用时,v-model与复选框一起使用有效v-for

new Vue({
  el: '#example',
  data: {
    names: [
      { name: 'jack', checked: true },
      { name: 'john', checked: false },
      { name: 'mike', checked: false }
    ]
  }
})
Run Code Online (Sandbox Code Playgroud)
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.13/vue.min.js"></script>
<div id='example'>
  <div v-for="(item, index) in names" :key="index">
  <input type="checkbox" :id="item.name" v-model="item.checked">
  <label :for="item.name">{{ item.name }} {{ item.checked }}</label>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

与对象的属性v-model一起使用时,与复选框一起使用不起作用:v-for

new Vue({
  el: '#example',
  data: {
    names: {
      jack: true,
      john: false,
      mike: false
    } …
Run Code Online (Sandbox Code Playgroud)

html javascript vue.js vuejs2

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

是否可以在vue 2中使用没有组件的vue-router?

我有一个非常简单的页面,只有几行代码,我想使用没有vue组件的vue-router.

我想得到string "my-search-query"根后:

www.example.com/my-search-query
Run Code Online (Sandbox Code Playgroud)

并在我的主Vue()对象中使用它.这可能吗?

谢谢!

vue.js vue-router vue-component vuejs2

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

无法在两个 NET Standard 项目中合并 NuGet 包可传递依赖项版本

将 EF Core 添加到 NET Standard 项目会引入与其他项目中的 NuGet 包不兼容的可传递依赖项版本

我有一个包含多个 .NET Standard 2.0 项目的解决方案。

一个项目 A使用Google.Protobuf (3.11.2)NuGet 包,这取决于

System.Memory (4.5.3)
    System.Buffers (4.4.0)
    System.Numerics.Vectors (4.4.0)
    System.Runtime.CompilerServices.Unsafe (4.5.2)
Run Code Online (Sandbox Code Playgroud)

其他一些项目也依赖System.Memory并且都使用相同的依赖版本

另一个项目 B使用Microsoft.EntityFrameworkCore (3.1.0)依赖于的 NuGet 包

System.Memory (4.5.3)
    System.Buffers (4.5.0)
    System.Numerics.Vectors (4.5.0)
    System.Runtime.CompilerServices.Unsafe (4.7.0)
Run Code Online (Sandbox Code Playgroud)

即使System.Memory版本是在两种情况下(4.5.3),这取决于System.BuffersSystem.Numerics.VectorsSystem.Runtime.CompilerServices.Unsafe和他们的版本不同。

当我运行使用这些项目的应用程序(使用 Unity IoC 的 Microsoft Prism WPF .NET Framework 4.8 应用程序)时,UnityContainer 会引发以下异常:

System.IO.FileLoadException: '无法加载文件或程序集 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 或其依赖项之一。定位的程序集的清单定义与程序集引用不匹配。 …

c# prism unity-container visual-studio entity-framework-core

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

如何获取所有标记为“完成”的 Google 日历目标和提醒

Google 日历中,您可以:

1.) 将目标标记为“做到了”:

目标

2.) 将提醒标记为“标记为完成”:

提醒

3.) 将任务标记为“标记完成”:

任务

我知道可以使用Google Tasks API通过检查字符串属性并将其与以下各项进行比较来获取标记为“完成”的所有任务的列表:task.status"completed"

https://developers.google.com/tasks/v1/reference/tasks

Google Calendar API 中,我只找到了“事件”——从未提到过目标,而提醒仅作为事件的“电子邮件/短信/弹出”提醒被提及(这不是我想要的)

https://developers.google.com/calendar/v3/reference/

我找不到Google Keep API

如何获得标记为“完成”的所有目标和提醒的列表?

我愿意使用任何东西:Google Calendar / Google Tasks / Google Keep

我会在 Javascript 或 PHP 中使用任何官方或非官方/开源 API。

我将不胜感激任何答案或建议,谢谢!

javascript php google-calendar-api google-api google-tasks-api

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

相当于 WCF 服务发现的 gRPC

编辑:我不想使用 Consul 或 ZooKeeper。我想在本地网络上查找 Web 服务的地址。

什么是WCF,像服务发现类的GRPC等价物:ServiceDiscoveryBehaviorUdpDiscoveryEndpointDiscoveryClient此示例中使用:

服务:

using (ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress))
{
    // Add calculator endpoint
    serviceHost.AddServiceEndpoint(typeof(ICalculator), new WSHttpBinding(), string.Empty);

    // ** DISCOVERY ** //
    // Make the service discoverable by adding the discovery behavior
    ServiceDiscoveryBehavior discoveryBehavior = new ServiceDiscoveryBehavior();
    serviceHost.Description.Behaviors.Add(discoveryBehavior);

    // Send announcements on UDP multicast transport
    discoveryBehavior.AnnouncementEndpoints.Add(new UdpAnnouncementEndpoint());

    // ** DISCOVERY ** //
    // Add the discovery endpoint that specifies where to publish the services
    serviceHost.Description.Endpoints.Add(new UdpDiscoveryEndpoint());

    // …
Run Code Online (Sandbox Code Playgroud)

.net c# wcf .net-core grpc

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

当有7个或更多选项时,Chrome中的选择框是1px太高了

在Chrome中尝试此功能(在Firefox中可以正常运行):

opened box is perfect size with 6 or fewer options
<br>
<select>
    <option style="background-color:red">red</option>
    <option style="background-color:green">green</option>
    <option style="background-color:blue">blue</option>
    <option style="background-color:cyan">cyan</option>
    <option style="background-color:yellow">yellow</option>
    <option style="background-color:magenta">magenta</option>
</select>
<br>
opened box is 1px too high with 7 or more options
<br>
<select>
    <option style="background-color:red">red</option>
    <option style="background-color:green">green</option>
    <option style="background-color:blue">blue</option>
    <option style="background-color:cyan">cyan</option>
    <option style="background-color:yellow">yellow</option>
    <option style="background-color:magenta">magenta</option>
    <option style="background-color:gray">gray</option>
    <!-- here is 1px white when opened -->
</select>
Run Code Online (Sandbox Code Playgroud)

打开选择框时,您会注意到bottem上有1px的白线.

这可以修复吗?

编辑:Chrome版本65.0.3325.146

编辑2:它似乎取决于屏幕分辨率(在1920x1080和1920x1200上测试)

html css google-chrome

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

Monodevelop C#脚本执行错误

我有一个非常简单的if语句没有按预期工作.

我的主要问题是,即时窗口以不同于代码执行的方式评估if语句:

   if( FreeProductStorageVolume < product.Volume * quantity )
   {
      Debug.Log( FreeProductStorageVolume );
      Debug.Log( product.Volume );
      Debug.Log( quantity );
      Debug.Log( product.Volume * quantity );
      canProduce = false;
   }
Run Code Online (Sandbox Code Playgroud)

所有变量都是浮点数

在此输入图像描述

一切都表明第824行的断点不应该被击中.

即使是立即窗口也会将if()语句计算为false.

有没有这样的事情发生在其他人身上?

c# if-statement immediate-window monodevelop unity-game-engine

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

为什么C ++ msgpack-c在数字10(0x0A)之前添加数字13(0x0D),而C#MessagePack-CSharp却不呢?

我试图使用MessagePack在C ++和Windows的C#中将0到127之间的整数序列化,但是结果不一样。msgpack-c在0x09和0x0A之间插入0x0D,但MessagePack-CSharp不插入。这是为什么?

作业系统:Windows 10

IDE:Visual Studio 2019

C#

图书馆:

https://github.com/neuecc/MessagePack-CSharp

码:

using System.Collections.Generic;
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        using (FileStream fileStream = new FileStream("CSharp.msgpack", FileMode.Create, FileAccess.Write))
        {
            List<int> list = new List<int>();

            for (int i = 0; i < 128; ++i)
            {
                list.Add(i);
            }

            MessagePackSerializer.Serialize(fileStream, list);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

结果:

尖锐的

C ++

图书馆:

https://github.com/msgpack/msgpack-c

码:

#include <msgpack.hpp>
#include <vector>
#include <iostream>
#include <fstream>

int main(void)
{
    std::ofstream OutputFileStream;

    std::vector<int> list;

    for (int i = 0; …
Run Code Online (Sandbox Code Playgroud)

c# c++ binary-serialization msgpack

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