小编Ric*_*cha的帖子

CSS3 - 在css3转换结束后更改z-index

我想在完成后更改z-indexdiv opacity translations,只有CSS3属性.

我有什么方法可以做到这一点?

遵循CSS3代码:

.high-light{
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    background-color: black;
    background-color: rgba(0, 0, 0, 0.61);
    opacity:0;
    left: 0;
    -webkit-transition: opacity 0.5s;
    -moz-transition: opacity 0.5s;
    transition: opacity 0.3s linear;
    z-index: 1;
}


.high-light.high-light-active  { 
    opacity:1;
    z-index: 1;
}
Run Code Online (Sandbox Code Playgroud)

注意:当div具有类时high-light-active,我首先想要转换,并且在转换之后z-index value.

css css3

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

警告TS0:@param上的类型注释与其TypeScript类型无关,请删除{...}部分

编译我的角度应用程序时出现错误:

错误:ngc编译失败:ng-formly / core / src / utils.ts(194,1):警告TS0:@param上的类型注释因其TypeScript类型而多余,请删除{...}部分

在utils.ts文件中,我具有以下功能:

/**
 * Delegates the subscription of any event and assign the subscription to a particulary domElement.
 * Each Time the event is trigger, the handler function will be call
 * Ex: delegate("domElement", "focus", "input", (focus) => console.log(focus))
 * @param {any} domElement The dom element. Ex: document
 * @param {string} eventType The event type. Ex."focus" 
 * @param {string} domElementType The dom element type. Ex. "input"
 * @param {Function} author The handler function. …
Run Code Online (Sandbox Code Playgroud)

typescript angular

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

Fabric.js :更改一个或多个选择的正方形/矩形颜色

我正在开发一个使用Fabric.js库的项目。我想知道如何更改当您想要选择一个或多个对象时出现的正方形/矩形。

就是下图中的蓝色矩形:

在此输入图像描述

我已经在更改一些样式,例如对象选择的角颜色、边框颜色等等:

fabric.Object.prototype.selection = !HelperJSViewBag.getValue("isMobile") && true;
fabric.Object.prototype.selectionColor = HelperJSViewBag.getValue("selectionColor").length > 0 ? HelperJSViewBag.getValue("selectionColor") : 'rgba(255,119,0,0.3)';
fabric.Object.prototype.rotationCursor = HelperJSViewBag.getValue('cursor_rotacao').length > 0 ? HelperJSViewBag.getValue('cursor_rotacao') : "crosshair";
fabric.Object.prototype.cornerSize = HelperJSViewBag.getValue("isMobile") ? (HelperJSViewBag.getValue("containerCornerSizeMobile") > 0 ? HelperJSViewBag.getValue("containerCornerSizeMobile") : 14) : (HelperJSViewBag.getValue("containerCornerSize") > 0 ? HelperJSViewBag.getValue("containerCornerSize") : 10);
fabric.Object.prototype.cornerColor = HelperJSViewBag.getValue("containerCornerColor").length > 0 ? HelperJSViewBag.getValue("containerCornerColor") : '#eee';
fabric.Object.prototype.borderColor = fabric.Object.prototype.cornerColor;
fabric.Object.prototype.transparentCorners = false;
fabric.Object.prototype.borderScaleFactor = HelperJSViewBag.getValue("borderScaleFactor") > 0 ? HelperJSViewBag.getValue("borderScaleFactor") : 1;
fabric.Object.prototype.hasRotatingPoint = !HelperJSViewBag.getValue("isMobile") && true;
fabric.Object.prototype.rotatingPointOffset = HelperJSViewBag.getValue("isMobile") ? …
Run Code Online (Sandbox Code Playgroud)

html javascript fabricjs

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

Uncaught SyntaxError: Unexpected eval or arguments in strict mode: window.gtag = (arguments) => dataLayer.push(arguments);

我有以下代码:

class MetricGoogleGateway extends AMetricGateway{
    constructor(id, name, token) {
        super(id, name);
        this.token = token;
    }

    configure() {
        if(!window.dataLayer && !window.gtag)
        {
             window.dataLayer = window.dataLayer || [];
             window.gtag = (arguments) => dataLayer.push(arguments);
        }

        gtag('js', new Date());
        gtag('config', 'UA-113071675-1');
    }
}
Run Code Online (Sandbox Code Playgroud)

当浏览器加载文件时,我收到以下错误:

未捕获的语法错误:严格模式下出现意外的 eval 或参数

但是如果我在 chrome 控制台中运行以下几行,一切正常:

window.dataLayer = window.dataLayer || [];
window.gtag = (arguments) => dataLayer.push(arguments);
window.gtag(1);
window.gtag(2);
console.log(window.dataLayer)
-> console.log result: [1,2]
Run Code Online (Sandbox Code Playgroud)

笔记:

我注意到如果我改变了这一行:

window.gtag = (arguments) => dataLayer.push(arguments);
Run Code Online (Sandbox Code Playgroud)

对于线路:

window.gtag = function(arguments) { dataLayer.push(arguments) }
Run Code Online (Sandbox Code Playgroud)

我犯了同样的错误

javascript ecmascript-6

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

在 HTML 上使用 setter 和 getter 变量(角度组件)

我创建了一个简单的 angular 组件来测试使用 getter/setter 样式的变量的用法:

import { Component } from '@angular/core';

@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.css' ]
})
export class AppComponent  {
  _name = 'Variable Example';
  get name(): string {
    console.log("GET!!!");
    return this._name;
  }

  set name(value:string): void {
    this._name = value;
  }
}
Run Code Online (Sandbox Code Playgroud)

然后,我在 html 上使用这个变量:

<p>
  {{ name }}
</p>
Run Code Online (Sandbox Code Playgroud)

我注意到的是,它get name()被调用了 4 次(在这里查看

是否有任何最佳实践规则指出这一点getter并且setters不应在 html 组件上使用?使用这种方法会出现性能问题吗?

谢谢!

PS:这不是真实的场景,它只是我正在做的一个小例子。

typescript angular

3
推荐指数
2
解决办法
8549
查看次数

Visual Studio代码cmd错误:无法加载,因为此系统上的运行脚本被禁用

在Visual Studio代码内部,我试图从命令行执行script.bat,但出现以下错误:

无法加载文件C:\ Theses_Repo \ train-cnn \ environment \ Scripts \ activate.ps1,因为此系统上的运行脚本已禁用。

读完这篇文章后,我试图以管理员模式运行Visual Studio代码,以为问题出在特权上。但是无论如何都会抛出错误。

powershell command-line visual-studio-code vscode-settings

3
推荐指数
13
解决办法
3666
查看次数

未找到 ./src/polyfills.ts 模块中的错误:错误:无法解析“zone.js/dist/zone”

我有一个 angular 8,它使用 karma/jasmine 来运行一些单元测试。我可以通过执行以下命令来运行测试,ng test但出现以下错误:

找不到 ./src/polyfills.ts 模块中的错误:错误:无法解析 'C:\PrjNET\Elevation3\FW\4.00\Project\Framework\Development\Client\ElevationJS 中的 'zone.js/dist/zone' \shell\src' 解析 'C:\PrjNET\Elevation3\FW\4.00\Project\Framework\Development\Client\ElevationJS\shell\src' 中的 'zone.js/dist/zone'

有谁知道怎么解决?

unit-testing jasmine typescript karma-runner angular

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

如何将属性选项卡添加到 Visual Studio 2019 中的类库项目?

我有一个Visual Studio 2019解决方案,其中有几个Class Library针对.NET Standard 2. 这些项目中的每一个都有一个属性选项卡,如下图所示:

属性选项卡

在属性选项卡中,有几个文件(例如程序集信息类和资源文件)

问题:

Class Library在解决方案中添加了一个新项目。然后我注意到属性选项卡不存在,我找不到添加它的方法。

如何将属性选项卡添加到新创建的项目中,以便与解决方案的其余部分保持一致?

.net visual-studio .net-standard-2.0 visual-studio-2019

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

错误:必须使用“allowedNonPeerDependencies”选项明确允许依赖关系@types/html2canvas

我已经在我的 angular 库项目中安装了html2canvas,当我在生产模式下编译(运行ng build --prod命令)时,我收到以下错误:

错误:必须使用“allowedNonPeerDependencies”选项明确允许依赖关系@types/html2canvas。

我该如何解决?

javascript npm typescript angular-cli angular

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

将数组转换为地图打字稿

我试图将以下数组转换为地图:

const arr = [
  { key: 'user1', value: { num: 0, letter: 'a' } },
  { key: 'user2', value: { num: 0, letter: 'b' } },
  { key: 'user3', value: { num: 0, letter: 'c' } },
];
Run Code Online (Sandbox Code Playgroud)

到目前为止我所拥有的:

const arr = [
  { key: 'user1', value: { num: 0, letter: 'a' } },
  { key: 'user2', value: { num: 0, letter: 'b' } },
  { key: 'user3', value: { num: 0, letter: 'c' } },
];
const b …
Run Code Online (Sandbox Code Playgroud)

javascript arrays dictionary typescript

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