小编Hov*_*yan的帖子

无效的配置对象output.path不是绝对路径

我尝试使用webpack将".ts"编译为".js",但是出现此错误,我该如何解决这个问题?

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.output.path: The provided value "./dist" is not an absolute path!"
Run Code Online (Sandbox Code Playgroud)

javascript typescript webpack

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

不使用任何输入将文本复制到剪贴板

我刚刚在网上看到很多文章找到了将文本复制到剪贴板的解决方案。但每个教程都用输入示例进行解释。

  function GeeksForGeeks() {
            var copyGfGText = document.getElementById("GfGInput");
            copyGfGText.select();

            document.execCommand("copy");

            alert("Copied the text: " + copyGfGText.value);
          }
Run Code Online (Sandbox Code Playgroud)
  <input type="text" value="GeeksForGeeks" id="GfGInput">

         <!-- The button used to copy the text -->
         <button onclick="GeeksForGeeks()">Copy text</button>
Run Code Online (Sandbox Code Playgroud)

但我只需要复制一个简单的文本。有没有办法将简单字符串从变量复制到剪贴板?例子`

let text = "copy this text to the clipboard";
Run Code Online (Sandbox Code Playgroud)

html javascript clipboard

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

需要根据行索引隐藏 ngx-datatable 的行

我有一个数据表,我在其中显示分支数据,但需要隐藏索引为 0 的项目。

    <ngx-datatable
          class="data-table table-responsive task-list-table"
          [rows]="branches"
          [loadingIndicator]="loadingIndicator"
          [columnMode]="'force'"
          [headerHeight]="50"
          [footerHeight]="50"
          [limit]="10"
          [rowHeight]="66"
          [reorderable]="reorderable">
          <ngx-datatable-column name="Branch Office Name">
            <ng-template let-rowIndex="rowIndex" *ngIf="rowIndex != 0" let- 
            branch="row" ngx-datatable-cell-template>
              {{branch['name']}}
            </ng-template>
          </ngx-datatable-column>
          <ngx-datatable-column name="Parent Branch">
            <ng-template let-rowIndex="rowIndex" *ngIf="rowIndex != 0" let- 
             branch="row" ngx-datatable-cell-template>
              {{branch['parentOrganizationName']}}
            </ng-template>
          </ngx-datatable-column>
  </ngx-datatable>
Run Code Online (Sandbox Code Playgroud)

我试过用 *ngIf 指令来做,但它不起作用。我该如何解决这个问题?

javascript ngx-datatable angular angular5

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

我应该在 typeScript 中定义 json 数据的类型吗?

在我的项目中,我在购物应用程序中使用此 json 来获取按热门类型和品牌类型分隔的产品。我试图为整个 json 对象定义一个“完整”类型,但它在我的代码中无法正常工作。我尝试对 json 使用这种方法。但似乎与实际数据类型不匹配

import {Product} from './Product';

export class Data {
  products: {branded: Product[], hot: Product[]};
  users: {}[];
}

export class Product {
  content: string;
  image: string;
  price: string;
  title: string;
}

export const DATA = {
  "products": {
    "hot": [
      {
        "title": "Hot Tittle 1",
        "content": "Hot Content 1",
        "image": "...",
        "price": "100"
      },
      {
        "title": "Hot Tittle 2",
        "content": "Hot Content 2",
        "image": "...",
        "price": "200"
      },
      {
        "title": "Hot Tittle 3",
        "content": "Hot …
Run Code Online (Sandbox Code Playgroud)

javascript typescript typescript-typings angular

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

无法更改 react-elastic-carousel 中点的样式

我正在为一个项目使用 react-elastic-carousel,但找不到改变点颜色(分页)的方法。如何更改点和活动点的颜色?

import React, {Component} from 'react';
import Item from '../Item/Item';
import Carousel from 'react-elastic-carousel';

import classes from './Test.module.css';

class Gallery extends Component {

    render() {
        return (
            <div>
                <Carousel
                    itemsToShow={1}
                    style={{backgroundColor: 'red', color: 'white'}}
                >
                    <Item>1</Item>
                    <Item>2</Item>
                    <Item>3</Item>
                    <Item>4</Item>
                    <Item>5</Item>
                    <Item>6</Item>
                </Carousel>
            </div>
        )
    }
}

export default Gallery;
Run Code Online (Sandbox Code Playgroud)

carousel reactjs

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