RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-295441

Виталий Шебаниц's questions

Martin Hope
Vitaliy Stop_RU_war_in_UA
Asked: 2024-05-20 04:34:03 +0000 UTC

组的 Svg 渐变

  • 7

有svg一个组包装器,旨在一次性将样式应用于内部组的所有 5 个元素。然而,径向梯度基本上不会应用于整个组,而是单独应用于 5 个组中的每一个。怎样才能一次性应用到所有人身上呢?我究竟做错了什么?

<svg width="800" height="100" viewBox="0 0 800 100" fill="none" xmlns="http://www.w3.org/2000/svg">
  <defs>
    <filter id="filter0_i_406_6193" x="0.0524902" y="0" height="41.5858" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB" width="100%">
      <feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood>
      <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend>
      <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix>
      <feOffset></feOffset>
      <feGaussianBlur stdDeviation="1.5"></feGaussianBlur>
      <feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"></feComposite>
      <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.65 0"></feColorMatrix>
      <feBlend mode="normal" in2="shape" result="effect1_innerShadow_406_6193"></feBlend>
    </filter>
    <radialGradient id="paint0_radial_406_6193" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(152 21.0001) rotate(-180) scale(154 1129.33)">
      <stop stop-color="#738898" stop-opacity="0"></stop>
      <stop offset="1" stop-color="#738898"></stop>
    </radialGradient>
    <radialGradient id="paint1_radial_406_6193" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(152) rotate(90) scale(42 520.249)">
      <stop stop-color="#9B8474"></stop>
      <stop offset="1" stop-color="#D5AF71" stop-opacity="0"></stop>
    </radialGradient>
  </defs>

  <g filter="url(#filter0_i_406_6193)" fill-opacity="0.65" fill="url(#paint0_radial_406_6193)">
    <!-- Левый блок с углами -->
    <g transform="translate(0, 0)">
      <path d="M14.9626 2.94761C16.8395 1.06082 19.391 0 22.0523 0H40V40H22.0523C19.391 40 16.8395 38.9392 14.9626 37.0524L1.50763 23.5262C-0.432568 21.5757 -0.432566 18.4243 1.50763 16.4738L14.9626 2.94761Z"></path>
    </g>
    <!-- Ровный участок между левым блоком и центром -->
    <g transform="translate(40, 0)">
      <rect height="40" width="216"></rect>
    </g>
    <!-- Центральный блок -->
    <g transform="translate(256, 0)">
      <path d="M 0 0 H 8 V 40 H 6.4142 C 6.149 40 5.8946 40.1054 5.7071 40.2929 L 4.7071 41.2929 C 4.3166 41.6834 3.6834 41.6834 3.2929 41.2929 L 2.2929 40.2929 C 2.1054 40.1054 1.851 40 1.5858 40 H 0"></path>
    </g>
    <!-- Ровный участок между центром и правым блоком -->
    <g transform="translate(264, 0)">
      <rect height="40" width="216"></rect>
    </g>
    <!-- Правый блок с углами -->
    <g transform="translate(480, 0)">
      <path d="M0 0H17.948C20.609 0 23.1605 1.06082 25.0374 2.94761L38.4924 16.4738C40.4326 18.4243 40.4326 21.5757 38.4924 23.5262L25.0374 37.0524C23.1605 38.9392 20.609 40 17.948 40H0V0Z"></path>
    </g>
  </g>
</svg>

svg
  • 1 个回答
  • 18 Views
Martin Hope
Vitaliy Stop_RU_war_in_UA
Asked: 2024-04-08 22:44:58 +0000 UTC

用于调试 npm 库的连接

  • 5

我在 npm 上有一个组织/库(看起来像 @my-org/core、@my-org/func、@my-org/models)。这些库存储了工作的常见类型和逻辑,到目前为止它们将用于 3 个项目。我想调试它们(不进行推送等npm)。我读到,为了引用库,您需要在构建中创建全局符号链接,然后在项目中引用它。我在构建中执行此操作npm link- 链接已创建,一切都很好。然后在您的项目中创建一个链接npm link @my-org/core- 一切都很好(在 node_modules 文件夹中创建了一个文件夹@my-org,并且其中有一个链接core。但是一旦我想链接另一个链接(@my-org/func) - 然后该链接@my-org文件夹中的to core被删除,然后出现func。我该如何制作才能保存所有链接(其中有两个以上,但我怎样才能制作至少2个)???

windows
  • 1 个回答
  • 13 Views
Martin Hope
Виталий Шебаниц
Asked: 2022-07-08 14:59:48 +0000 UTC

解释 iif 的行为

  • 0

我假设 iif (注释掉)与重写的 if 相同。Iif 返回到 switchMap。问题是,当涉及到时iif,两个块(真块和假块)都被执行了。这是为什么?

private sendRequest<T>(
    method: EQueryMethod,
    url: string,
    body: any,
    headers: RequestHeaders,
    type: 'json' | 'multipart'
  ): Observable<T> {
    const platform = Capacitor.getPlatform();
    return of({}).pipe(
      switchMap(
        (s) => {
          if (platform === 'android') {
            return this.sendRequestAndroid(method, url, body, headers, type);
          } else {
            return this.sendRequestWeb(
              method,
              url,
              method === EQueryMethod.GET ? {} : body,
              method === EQueryMethod.POST ? {} : body,
              headers
            );
          }
        }
        // iif(
        //   () => platform === 'android',
        //   this.sendRequestAndroid(method, url, body, headers, type),
        //   this.sendRequestWeb(
        //     method,
        //     url,
        //     method === EQueryMethod.GET ? {} : body,
        //     method === EQueryMethod.POST ? {} : body,
        //     headers
        //   )
        // )
      ),
      take(1)
    );
  }
angular
  • 1 个回答
  • 10 Views
Martin Hope
Виталий Шебаниц
Asked: 2022-01-19 21:58:40 +0000 UTC

接口实现

  • 1

您如何以不同的方式实现接口(通过类),接口中的第一行给出了什么?它只是一个函数的接口吗?

export interface ITest {
  (): string;
  name: string;
}

我用一个函数做到了:

function d(): ITest {
  let v: ITest = (): string => "123";
  // v.name = "123";
  return v;
}
typescript
  • 1 个回答
  • 10 Views
Martin Hope
Виталий Шебаниц
Asked: 2020-05-27 21:59:25 +0000 UTC

自动映射器中的反序列化

  • 0

有一个代码:

        CreateMap<Mnemoelement, MnemoelementDTO>()
            .ForMember(nameof(MnemoelementDTO.Settings), opt => opt.MapFrom(me => JsonConvert.DeserializeObject<__type__>(me.Settings)));

__type__ - 因属性而异me.Type( string)

例如,如果me.Type == "LINE",则反序列化为类型LineSettings,如果me.Type == "CIRCLE",则反序列化为类型CircleSettings。

MapFrom如果您以某种方式将其插入其中,switch它会有所帮助,但是如何?

如何实施?

c#
  • 1 个回答
  • 10 Views
Martin Hope
Виталий Шебаниц
Asked: 2020-05-20 18:39:40 +0000 UTC

双重通话触发

  • 1

transitransitionend它被调用了2次,我不明白为什么。

$("#t").click(function(){
  $("#d").toggleClass("asd");
});

$(".asd").on("transitionend MSTransitionEnd webkitTransitionEnd oTransitionEndtionend", function(){
  alert(123)
});
.asd {
  display:block;
  transition: all .2s;
  background-color: red;
  height: 400px;
}

div:not(.asd) {
  height:0px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button id="t">test</button>
<div class="asd" id="d">asdasfasd</div>

javascript
  • 1 个回答
  • 10 Views
Martin Hope
Виталий Шебаниц
Asked: 2020-04-02 04:36:32 +0000 UTC

将样式连接到项目

  • 0

有一个文本脉冲代码。我可以以某种方式将它们塞入文件中,以便它们位于本地吗?

@import url(https://fonts.googleapis.com/css?family=Open+Sans);

body {
 background: black;
 font-family: "Open Sans",  Impact;
}

.area {
  text-align: center;
  font-size: 6.5em;
  color: #fff;
  letter-spacing: -7px;
  font-weight: 700;
  text-transform: uppercase;
  animation: blur .75s ease-out infinite;
  text-shadow: 0px 0px 5px #fff, 0px 0px 7px #fff;
}

@keyframes blur {
  from {
    text-shadow:0px 0px 10px #fff,
      0px 0px 10px #fff, 
      0px 0px 25px #fff,
      0px 0px 25px #fff,
      0px 0px 25px #fff,
      0px 0px 25px #fff,
      0px 0px 25px #fff,
      0px 0px 25px #fff,
      0px 0px 50px #fff,
      0px 0px 50px #fff,
      0px 0px 50px #7B96B8,
      0px 0px 150px #7B96B8,
      0px 10px 100px #7B96B8,
      0px 10px 100px #7B96B8,
      0px 10px 100px #7B96B8,
      0px 10px 100px #7B96B8,
      0px -10px 100px #7B96B8,
      0px -10px 100px #7B96B8;
  }
}
<body>
<div class="area">asd</div>
</body>

css
  • 1 个回答
  • 10 Views
Martin Hope
Виталий Шебаниц
Asked: 2020-03-14 20:37:25 +0000 UTC

一行需要澄清

  • 1

我不明白,我在互联网上找不到字符串是如何工作的var exp = (o>4), o = o%5, str = pangrams[+exp][o];。解释 - 谁知道,以及如何谷歌?

var pangrams = [ 
  // not pangrams:
    [ 
      "This isn't a pangram!",
      "abcdefghijklmopqrstuvwxyz ",
      "aaaaaaaaaaaaaaaaaaaaaaaaaa",
      "Detect Pangram",
      "A pangram is a sentence that contains every single letter of the alphabet at least once."
    ],
  
  // pangrams:
    [
      "Cwm fjord bank glyphs vext quiz",
      "Pack my box with five dozen liquor jugs.",
      "How quickly daft jumping zebras vex.",
      "ABCD45EFGH,IJK,LMNOPQR56STUVW3XYZ",
      "AbCdEfGhIjKlM zYxWvUtSrQpOn"
    ]
  ];

[0,1,2,3,4,5,6,7,8,9].forEach(function(o){
  var exp = (o>4), o = o%5, str = pangrams[+exp][o]; // как работает дання строка и что она делает?
  console.log(str);
});

javascript
  • 2 个回答
  • 10 Views
Martin Hope
Виталий Шебаниц
Asked: 2020-12-21 00:57:50 +0000 UTC

Git丢失信息

  • 2

问题:提交(即更改)的信息消失了。

我做了什么(由于我缺乏经验......通常我会提交 git..pushed......smerged......嗯,总的来说,本着这种精神):

1) 在 VS 2019 studio + GitLab 扩展中工作。

2)它有一个选项удержать(stash如果在控制台中)。

3)之后我意识到这不是我需要的并尝试恢复(我按下了这样一个按钮 - 我不知道当时正在执行哪些控制台命令)。

4)操作没有完成,我看到了一个错误stash applay和一个红叉(没有别的)......车轮转动后5秒(就像工作室在想的那样)。然后她关掉了自己。

5)我开始工作室,没有文件被搁置......只是没有,就是这样

6)git stash list来自命令行的命令:

在此处输入图像描述

即空虚。

对旧提交有某种回滚(自动)。不清楚的是……有些变化仍然存在,有些则愚蠢地消失了。

纯粹是逻辑思维git,他必须将信息存储在某个地方......也就是说,他要么删除他的文件并创建一个新文件,要么重新加载信息......

问:有没有可能尝试一些东西作为恢复

你可以提供任何你能想到的...

如果您需要更多信息,请告诉我,我会提供。

git
  • 1 个回答
  • 10 Views
Martin Hope
Виталий Шебаниц
Asked: 2020-11-15 19:37:39 +0000 UTC

docker postgres 图像更改

  • 0

我想从 docker hub 获取一个常规的 postgres 图像并向其中添加一个用户(这就是正确操作所需的全部内容)。

1)我拍摄图像并运行:docker run -d -p 5432:5432 postgres:11.5。

2)我使用客户端连接到服务器postgres并添加用户。

3)漫画我的形象并推送到我的帐户docker hub

4)我从测试机上获取图像

结果,没有用户……为什么?它完全是这样工作的(我在互联网上找到了这个,就像写它是一个工作功能一样。

请指导在哪里挖什么

postgresql
  • 1 个回答
  • 10 Views
Martin Hope
Виталий Шебаниц
Asked: 2020-07-18 14:58:25 +0000 UTC

通过控制器中的变量启用/禁用选择

  • 0

有一个代码:

@{ string tempClass = ViewBag.IsCreate ? "enabled" : " disabled";}
<div class="text-primary h3 text-left col-2 pl-0">Скидка</div>
@Html.DropDownListFor(m => m.GroupDiscount, new SelectList(GroupsDiscount, "Key", "Value"), htmlAttributes: new { @class = "form-control selectedDiscountGroup col-md-10", @disabled=tempClass })

if = true如何ViewBag.IsCreate删除该属性disabled?否则没有任何效果

mvc
  • 1 个回答
  • 10 Views
Martin Hope
Виталий Шебаниц
Asked: 2020-07-03 20:35:27 +0000 UTC

专注于输入

  • 0

input按下按钮后无法自动转移焦点。

onclick在html

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.4/css/bootstrap.min.css" integrity="2hfp1SzUoho7/TsGGGDaFdsuuDL0LX2hnUp6VkX3CUQ2K4K+xjboZdsXyp4oUHZj" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.4/js/bootstrap.min.js" integrity="VjEeINv9OSwtWFLAtmc4JCtEJXXBub00gtSnszmspDLCtC0I4z4nqz7rEFbIZLLU" crossorigin="anonymous"></script>
<div class="btn-group w-100">
  <button type="button" class="btn border" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" onclick="$('#inputAutocompleteAccesses').focus();">Выбрать право</button>
  <div class="dropdown-menu col-12 shadow text-center">
    <div class="container-fluid p-0">
      <div class="row m-0 p-0">
        <input class="form-control mx-2" oninput="sendRequestAccessJson($(this).val());" id="inputAutocompleteAccesses" placeholder="Введите право" />
      </div>
      <div id="autocompleteAccesses">

      </div>

      <div class="row mx-1 justify-content-center">
        <p>1</p>
      </div>
      <div class="row mx-1 justify-content-center">
        <p>2</p>
      </div>
      <div class="row mx-1 justify-content-center">
        <p>3</p>
      </div>
    </div>


  </div>
</div>

现在我决定了:

function f(){
  $('#inputAutocompleteAccesses').focus();
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.4/css/bootstrap.min.css" integrity="2hfp1SzUoho7/TsGGGDaFdsuuDL0LX2hnUp6VkX3CUQ2K4K+xjboZdsXyp4oUHZj" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.4/js/bootstrap.min.js" integrity="VjEeINv9OSwtWFLAtmc4JCtEJXXBub00gtSnszmspDLCtC0I4z4nqz7rEFbIZLLU" crossorigin="anonymous"></script>
<div class="btn-group w-100">
  <button type="button" class="btn border" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" onclick="setTimeout(f, 10);">Выбрать право</button>
  <div class="dropdown-menu col-12 shadow text-center">
    <div class="container-fluid p-0">
      <div class="row m-0 p-0">
        <input class="form-control mx-2" oninput="sendRequestAccessJson($(this).val());" id="inputAutocompleteAccesses" placeholder="Введите право" />
      </div>
      <div id="autocompleteAccesses">

      </div>

      <div class="row mx-1 justify-content-center">
        <p>1</p>
      </div>
      <div class="row mx-1 justify-content-center">
        <p>2</p>
      </div>
      <div class="row mx-1 justify-content-center">
        <p>3</p>
      </div>
    </div>


  </div>
</div>

但它是怎么回事?

css
  • 1 个回答
  • 10 Views
Martin Hope
Виталий Шебаниц
Asked: 2020-07-01 15:56:28 +0000 UTC

实体将“1”添加到字段名称

  • 0

向表中添加迁移时,该字段是重复的(但以 结尾1):

            CreateTable(
            "public.t_users",
            c => new
                {
                    id = c.Int(nullable: false, identity: true),
                    login = c.String(),
                    password = c.String(),
                    name = c.String(),
                    role_id = c.Int(nullable: false),
                    role_id1 = c.Int(),
                })
            .PrimaryKey(t => t.id)
            .ForeignKey("public.t_roles", t => t.role_id1)
            .Index(t => t.role_id1);

虽然在数据库中它是一个:

-- Table: public.t_users

-- DROP TABLE public.t_users;

CREATE TABLE public.t_users
(
    name character varying(100) COLLATE pg_catalog."default" NOT NULL,
    login character varying(100) COLLATE pg_catalog."default" NOT NULL,
    password character varying(100) COLLATE pg_catalog."default" NOT NULL,
    role_id integer NOT NULL,
    id integer NOT NULL DEFAULT nextval('t_users_id_seq'::regclass)
)
WITH (
    OIDS = FALSE
)
TABLESPACE pg_default;

ALTER TABLE public.t_users
    OWNER to psp;

如果它只在迁移期间会很好......但是当保存到数据库时也会弹出这个字段......并且自然会发生错误Entity:

BaseMessage = "column \"role_id1\" of relation \"t_users\" does not exist"

模型:

namespace Loyalty.DAL.Models.Authorize
{
    [Table("t_users", Schema = "public")]
    public class User
    {
        [Key]
        public int? id { get; set; }
        public string login { get; set; }
        public string password { get; set; }
        public string name { get; set; }

        public int role_id { get; set; }
        public virtual Role role { get; set; }
    }
}

请解释“如何”,以及他为什么(Entity)添加此字段?

c#
  • 1 个回答
  • 10 Views
Martin Hope
Виталий Шебаниц
Asked: 2020-05-10 17:48:01 +0000 UTC

客户端上的日期时间验证

  • 0

该模型有一个字段

[DisplayName("Время начала")]
public DateTime? DateTimeStart { get; set; }//начало действия

鉴于我这样显示(我使用引导日期时间选择器):

@Html.EditorFor(m => m.DateTimeStart, new { htmlAttributes = new { @class = "form-control datetimepicker-input", @data_target = "#datetimepicker1", @id = "dateTimeStartForPosition", @value = "", @type = "text" } })

正确的格式只有这样:10-10-2018 12:12:12

如何指定不同的验证格式?即这通过了除模型验证之外的所有内容10.10.2018 12:12:12

c#
  • 1 个回答
  • 10 Views
Martin Hope
Виталий Шебаниц
Asked: 2020-04-22 15:59:36 +0000 UTC

与剃须刀链接

  • 0

表格怎么写data-value?目前datavalue

@Html.ActionLink("Позиционная", "Create", "Discount", new { Groups = Discount.GroupDiscountPosition } , new { @class = "dropdown-item", dataValue = Discount.GroupDiscountPosition })
razor
  • 1 个回答
  • 10 Views
Martin Hope
Виталий Шебаниц
Asked: 2020-04-18 22:48:43 +0000 UTC

以形式传递数组

  • 1

是否可以强制以数组的形式(例如表格)进行传输?还是需要单独形成数据后再ajax发送?

html
  • 2 个回答
  • 10 Views
Martin Hope
Виталий Шебаниц
Asked: 2020-04-18 21:44:16 +0000 UTC

复选框未在表单中提交值

  • 1

如果chekbox未选中,则submit不会向表单传递任何值false。如何让它转移?

html
  • 2 个回答
  • 10 Views
Martin Hope
Виталий Шебаниц
Asked: 2020-04-17 02:32:24 +0000 UTC

如何在 Github 上的 readme.md 中制作内容并跳转到章节?

  • 2

如何使“内容”原则像 MS Word 中一样工作?
例如,有内容,当您单击任何项​​目时,它会自动跳转到文本中。

github
  • 1 个回答
  • 10 Views
Martin Hope
Виталий Шебаниц
Asked: 2020-03-29 19:51:04 +0000 UTC

在模式窗口中打开表单时如何将焦点移动到按钮?

  • 0

我不明白为什么它不能正常工作。一切都很好,直到我将它添加input到模态窗口。如果是true,则一切正常:

在此处输入图像描述

但是,如果false,则窗口甚至不会出现(在控制台上它显示为好像它已经出现并且我按下了确定(即Enter)):

在此处输入图像描述

问题:为什么窗口没有出现时false?

main.component.ts

import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';

@Component({
  selector: 'app-menu',
  templateUrl: './menu.component.html',
  styleUrls: ['./menu.component.less']
})
export class MenuComponent implements OnInit {

  constructor(private router: Router) { }

 elements = [
    {
      title: "Копия чека",
      src: "../../assets/test.png",
      items: [
        {
          title: "Копия чека",
          src: "../../assets/test.png",
          action: () => {
            //console.log("show");
            this.titleModal = "Сделать копию чека?";
            this.isShowedDialog = true;
            this.iconModal = "../../assets/info.png"

          },  
          callback: () => {
            console.log(this.resultDialog);
          }  
        },
        .........
      ]
  // для хождения по группам
  currentItemGroup: number = 1;
  maxItemGroup: number = this.elements.length;
  minItemGroup: number = 1;
  // для хождения по детям группы
  currentItem: number = 1;
  minItem:number = 1;
  maxItem: number;
  // в данный момент по группам ходим?
  isGroup: boolean = true;
  // настройки для модального диалогового окна
  titleModal;
  discriptonModal
  buttonArrayModal = [{title:'Ок',class:'btn-success'},{title:'Отмена',class:'btn-danger'}];
  widthModal = '40%';
  iconModal;

ngOnInit() {
    this.onKeyDown();
  }

  onKeyDown() {
    document.onkeydown = (e) => {
      if (e.key === 'F1') {
        e.preventDefault();
        return false;
      }
      this.maxItem = this.elements[this.currentItemGroup - 1].items.length;
      switch (e.keyCode) {
        case 13: {

          if (this.isGroup)this.goToItem();
          else {
            this.elements[this.currentItemGroup - 1].items[this.currentItem - 1].action();
          }
          break;
       }
     }
   }
 }

isShowedDialog:boolean = false;
  resultDialog:string;

  onDialogClick(result:string){
    this.resultDialog = result;
    this.isShowedDialog = false;
    this.onKeyDown();
    this.elements[this.currentItemGroup - 1].items[this.currentItem - 1].callback();
    this.refreshDialog();
  }

  refreshDialog(){
    this.titleModal = null;
    this.discriptonModal= null;
    this.buttonArrayModal = [{title:'Ок',class:'btn-success'},{title:'Отмена',class:'btn-danger'}];
    this.widthModal = '40%';
    this.iconModal = undefined;
  }

在 menu.component.html 中:

<app-dialog-window [title]="titleModal" [discription]="discriptonModal" [buttonArray]="buttonArrayModal" [width]="widthModal" [icon]="iconModal" [input]="{hasVisible: false}" (onClickButton)="onDialogClick($event)" *ngIf="isShowedDialog"></app-dialog-window>

和组件本身:

import { Component, OnInit, Input, Output , EventEmitter, AfterViewInit } from '@angular/core';
declare var $: any;

@Component({
  selector: 'app-dialog-window',
  templateUrl: './dialog-window.component.html',
  styleUrls: ['./dialog-window.component.less']
})
export class DialogWindowComponent implements OnInit,AfterViewInit {
  @Input() title = "Подтвердите действие";
  @Input() discription;
  @Input() buttonArray: Array<any>;
  @Input() width = '40%';
  @Input() icon;
  @Input() input;
  inputData:string;

  @Output() onClickButton:EventEmitter<string> = new EventEmitter<string>();

  currentTab = 1;
  minTab = 1;
  maxTab;

  constructor() {   }

  ngAfterViewInit(){
    if (this.input.hasVisible) $("input").focus();
    else {
      $("button")[0].focus();
    }
  }

  ngOnInit() {
    this.onKeyDown();
    this.maxTab = this.buttonArray.length;
  }

  onClick(element:any){
    this.onClickButton.emit(element.innerText);
  }

  onKeyDown(){
    document.onkeydown = (e) => {
      if (e.key === 'F1') {
        e.preventDefault();
        return false;
      }
      switch (e.keyCode) {
        //Enter
        case 13: {
          this.buttonArray.forEach(el => {
            if (el.title === "Ок")
            {
              console.log(this.input);
              if (this.input.hasVisible){
                this.onClickButton.emit(this.inputData);
              }
              else {

                this.onClickButton.emit(el.title);
              }
            }

          });
          break;
        }
        // backspace
        case 27: {
          this.buttonArray.forEach(el => {
            if (el.title === "Отмена")
            this.onClickButton.emit(el.title);
          });
          break;
          break;
        }
        //вверх
        case 38: {
          this.next();
          break;
        }
        //вниз
        case 40: {
          this.prev();
          break;
        }
      }
    }
  }

  next(){
    if (this.currentTab < this.maxTab) this.currentTab++;
  }

  prev(){
    if (this.currentTab > this.minTab) this.currentTab--;
  }

}

更新:

如果在

 ngAfterViewInit(){
    if (this.input.hasVisible) $("input").focus();
    else {
      $("button")[0].focus();
    }
  }

zakomentit //$("button")[0].focus();,然后出现窗口....但是在自动打开表单时如何将焦点转移到按钮上?

angular
  • 1 个回答
  • 10 Views
Martin Hope
Виталий Шебаниц
Asked: 2020-03-28 17:57:10 +0000 UTC

无法正确获取块

  • 0

现在是这样的:

在此处输入图像描述

需要这样:

在此处输入图像描述

像这样的代码:

<div class="container-fluid h-100">
  <div class="row h-100">
    <div class="col-3 h-100">
      <div class="row h-15 my-3 justify-content-center" *ngFor="let el of elements;let ind = index;"
        [ngClass]="{'table-primary': currentItemGroup-1 === ind}">
        <div class="col h-100 text-center">
          <img src="{{el.src}}" height="80%" width="auto" alt="">
          <div class="h5">{{el.title}}</div>
        </div>
      </div>
    </div>
    <div class="col-9 h-25 my-4">
      <div class="div h-auto" *ngFor="let item of elements;let ind2 = index;">
        <div *ngIf="currentItemGroup-1 === ind2" class="h-100">
          <div class="ml-2 h-100 row" *ngFor="let i of item.items; let num = index">
            <div class="col-4 text-center h-100" *ngIf='num<4'>
              <img src="{{i.src}}" alt="" height="auto" width="100%"
                style="max-height:90%; max-width: 180px; min-width: 40px;">
              <div style="height: 10%">{{i.title}}</div>
            </div>
            <div class="col-4 offset-3 text-center h-100" *ngIf='num>=4 && num<8'>
              <img src="{{i.src}}" alt="" height="auto" width="100%"
                style="max-height:90%; max-width: 180px; min-width: 40px;">
              <div style="height: 10%">{{i.title}}</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

我不知道怎么捡起来。

вёрстка
  • 1 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5