小编Kay*_*Kay的帖子

Angular 5 - 在鼠标输入时显示一个按钮,鼠标离开时隐藏一个按钮

当用户将鼠标悬停在列表项上时,我希望显示一个按钮.当用户离开列表项时,我希望不显示该按钮.

我遇到了一个mouseenter事件和一个mouseleave.

html的

<mat-list-item (mouseenter)="enter($event)" (mouseleave)="leave($event)" class="chat-message-body" *ngIf="auth._id !== message.author._id" fxLayoutAlign=""
    dir="ltl">
    <div matLine>
        <b>{{message.author.profile.username}} </b>
        <span>{{message.created_at | date:'shortTime'}} </span>
    </div>
    <button mat-icon-button>
        <mat-icon aria-label="">keyboard_arrow_down</mat-icon>
    </button>
    <span matLine> {{message.body}} </span>
    <img matListAvatar class="img-box" src="http://via.placeholder.com/30x30" alt="...">
</mat-list-item>
Run Code Online (Sandbox Code Playgroud)

.TS

enter(e) {
    console.log("enter");
}

leave(e) {
    console.log("leave");
}
Run Code Online (Sandbox Code Playgroud)

除了声明这些功能之外,我不知道如何定位此列表项中的按钮以显示和隐藏它,具体取决于用户是否已输入列表项块或向左.

在此输入图像描述

angular-material angular

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

反应:ReferenceError:regeneratorRuntime 未定义

我正在尝试在我的 React 应用程序中使用 async 和 await。

   onSubmit = async (model) => {
        await this.setState({ data: model });
    }
Run Code Online (Sandbox Code Playgroud)

添加上述代码后,我的浏览器控制台出现错误。

参考错误:未定义 regeneratorRuntime

.babelrc

{
    "presets": ["@babel/preset-env", "@babel/preset-react"],
    "plugins": [
        "@babel/plugin-proposal-class-properties"
    ],
    "sourceMaps": "inline"

}
Run Code Online (Sandbox Code Playgroud)

webpack.config.js

const path = require("path");
const WebpackShellPlugin = require("webpack-shell-plugin");
const nodeExternals = require("webpack-node-externals");
const CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = [
    {
    Server config removed

 },

    {
        entry: {
            app1: './src/public/app1/index.js',
            app2: './src/public/app2/index.js',
            app3: './src/public/app3/index.js',
        },
        devtool: "source-map",
        output: {
            path: __dirname + '/dist/public/',
            publicPath: '/',
            filename: '[name]/bundle.js', …
Run Code Online (Sandbox Code Playgroud)

reactjs webpack babeljs

8
推荐指数
2
解决办法
8806
查看次数

如何将 scss 文件导入打字稿文件

我正在尝试将 .scss 文件导入到 .tsx 打字稿文件中。

但是我收到以下错误。当我跑npm run tsc

src/public/app1/index.tsx:5:20 - 错误 TS2307:找不到模块“./index.scss”。

5 从“./index.scss”导入样式;~~~~~~~~~~~~~~~

发现 1 个错误。

索引.tsx

import React from "react";
import { render } from "react-dom";
import App from "./App";
import styles from "./index.scss";

render(
    <App/>,
    document.getElementById("root"),
);
Run Code Online (Sandbox Code Playgroud)

索引.scss

body {
    background:red;
    color: #005CC5;
    text-align: center;
}
Run Code Online (Sandbox Code Playgroud)

我看到一个解决方案是在我的项目的根目录中创建一个 decleration.d.ts 文件。但这对我没有用。无法导入 CSS/SCSS 模块。TypeScript 说“找不到模块”

declaration.d.ts

declare module '*.scss';
Run Code Online (Sandbox Code Playgroud)

配置文件

{
  "compilerOptions": {
    /* Basic Options */
    // "incremental": true,                   /* Enable incremental compilation */
    "target": "es6",                          /* …
Run Code Online (Sandbox Code Playgroud)

sass typescript reactjs

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

ReplicaSetNoPrimary MongooseServerSelectionError:getaddrinfo EAI_AGAIN mongodb-primary

我已经在 docker 中设置了一个 mongodb 复制集。当我使用 cli 连接到 mongodb 时,它工作正常。但是,尝试使用 mongoose 包通过 node.js 连接到它会出现以下错误消息。

MongooseServerSelectionError: getaddrinfo EAI_AGAIN mongodb-primary at NativeConnection.Connection.openUri (/home/kay/checkpoint/stream-hatchet/node_modules/mongoose/lib/connection.js:800:32) at /home/kay/checkpoint/stream-hatchet /node_modules/mongoose/lib/index.js:341:10 在 /home/kay/checkpoint/stream-hatchet/node_modules/mongoose/lib/helpers/promiseOrCallback.js:31:5 在新 Promise () 在 PromiseOrCallback (/ home/kay/checkpoint/stream-hatchet/node_modules/mongoose/lib/helpers/promiseOrCallback.js:30:10) 在 Mongoose.connect (/home/kay/checkpoint/stream-hatchet/node_modules/mongoose/lib/index.html) js:340:10) 在 Object.MongoDBService [默认] (/home/kay/checkpoint/stream-hatchet/src/services/mongodb.service.ts:20:24) 在 Streaming (/home/kay/checkpoint/ stream-hatchet/src/main.ts:16:29) 在对象。(/home/kay/checkpoint/stream-hatchet/src/main.ts:38:1) 在 Module._compile (internal/modules/cjs/loader.js:1137:30) 在 Module.m._compile (/home /kay/checkpoint/stream-hatchet/node_modules/ts-node/src/index.ts:858:23) 在 Module._extensions..js (internal/modules/cjs/loader.js:1157:10) 在 Object.需要扩展。[as .ts] (/home/kay/checkpoint/stream-hatchet/node_modules/ts-node/src/index.ts:861:12) 在 Module.load (internal/modules/cjs/loader.js:985): 32) 在 Function.Module._load (internal/modules/cjs/loader.js:878:14) 在 Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) { 原因:TopologyDescription { 类型: 'ReplicaSetNoPrimary', setName: 'replicaset', maxSetVersion: 61323, …

mongoose mongodb node.js

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

Microsoft SQL Server 2008 Management Studio - 连接/服务器/实例问题

首先我最近安装了这个程序,因为我正在开发一个项目来创建一个在Microsoft Visual Studio中使用的数据库.

这是我第一次使用该程序,所以我在设置它时遇到了一些问题.我无法连接到服务器,因为我可能没有服务器.我键入我的机器名称以使用Windows身份验证创建默认/本地主机服务器但我收到错误.

错误:

标题:连接到服务器

建立与SQL Server的连接时发生与网络相关或特定于实例的错误.服务器未找到或无法访问.验证实例名称是否正确,以及SQL Server是否配置为允许远程连接.(提供程序:命名管道提供程序,错误:40 - 无法打开与SQL Server的连接)(Microsoft SQL Server,错误:2)

有人可以指导我如何设置本地主机进行连接,从而能够创建我的数据库.此外,我想知道如何创建一个服务器(ftp)连接并创建我的数据库,允许我在我的笔记本电脑或其他机器上查看.

顺便说一句,我已经在谷歌看了这个,但我有点困惑,因为我不确定我在寻找什么.如果有人能对我的问题有所了解,我将不胜感激.

谢谢.

sql-server-2008

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

角度材质5 - 在垫子列表中显示全文(自动换行)

我正在创建一个聊天框,每条消息都是一个角度材料垫列表.https://material.angular.io/components/list/overview.

但是,如果消息真的很长而不是增加高度并进入下一行,它会剪切消息并显示一个椭圆.如下图所示.

在此输入图像描述

 <mat-list dense>     
    <mat-list-item class="chat-message-body" *ngIf="auth._id !== message.author._id" fxLayoutAlign="" dir="ltl">
        <div matLine>
            <b>{{message.author.profile.username}} </b>
            <span>{{message.created_at | date:'shortTime'}} </span>
        </div>
        <span matLine> {{message.body}} </span>
        <img matListAvatar class="img-box" src="http://via.placeholder.com/30x30" alt="...">
    </mat-list-item>
</mat-list>
Run Code Online (Sandbox Code Playgroud)

我如何强制它显示全文

angular-material angular

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

角度材料表行 - 我如何在新选项卡中右键单击打开

我正在使用角度材料表来生成由我的服务器填充的表。

https://material.angular.io/components/table/overview

对于每一行,用户可以单击以打开进入新页面的详细版本。

<mat-row *matRowDef="let row; columns: displayedColumns;" (click)="show(row)"></mat-row>
Run Code Online (Sandbox Code Playgroud)

——

show(job) {
    this.router.navigate(['reports/', job.job_id]);
}
Run Code Online (Sandbox Code Playgroud)

然而,最终用户正确地指出,在有角材料表中,您不能右键单击并“在新选项卡中打开”,没有此选项。

我假设是因为 mat-row 不像锚标签那样工作。有什么办法可以让它像这样工作。

谢谢,

angular-material angular

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

如何使用sed用gitlab ci管道变量替换yml文件中的变量

我想用 gitlab ci 管道中的变量替换 .yml 文件中的变量。

gitlab-ci.yml

deploy_test:
  stage: deploy
  script:
    - sed -i 's/$TAG/$CI_COMMIT_REF_NAME/g' deploy/test.yml
    - kubectl apply -f deploy/test.yml
  when: manual
  only:
    - master
    - tags
Run Code Online (Sandbox Code Playgroud)

这在 deploy/test.yml 文件中说它应该用 $CI_COMMIT_REF_NAME 的值替换 $TAG 吗?

部署/测试.yml

image: git.<removed>.com:5005/eng/my-group/my-image:$TAG
Run Code Online (Sandbox Code Playgroud)

sed gitlab gitlab-ci

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

Angular 5 Material - 如何将mat-nav-list锚链接设置为在单击时处于活动状态

如何在我的实现中将锚链接设置为活动状态.

html的

<mat-nav-list class="conversation-list">
    <mat-list-item *ngFor="let conversation of conversations">
        <a (click)="goToChat(conversation)">{{getOtherUsers(conversation)}}</a>
    </mat-list-item>
</mat-nav-list>

<div class="chat-box">
    <router-outlet></router-outlet>
</div>
Run Code Online (Sandbox Code Playgroud)

.TS

goToChat(conversation) {
    this.router.navigate(['main/chat/', conversation._id]);
}
Run Code Online (Sandbox Code Playgroud)

.routing.module.ts

import { ChatComponent } from './chat.component';
import { ChatDetailComponent } from './chat-detail/chat-detail.component';

const CHAT_ROUTES = [
    {
        path: '',
        component: ChatComponent,
        children: [
            {
                path: ':id',
                component: ChatDetailComponent
            }
        ]
    },
];
Run Code Online (Sandbox Code Playgroud)

上面的代码循环用户对话并创建他们正在聊天的用户列表.每个列表项都是指向页面右侧聊天组件的链接.当用户单击链接并且我希望将其设置为活动时.

angular-material angular

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

如何在 github actions 工作流程 ci 中通过 npm 安装私有 github 存储库

我正在尝试通过运行在 github 工作流程 ci 中安装 npm 依赖项npm install。但是我收到以下错误:

npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://git@github.com/private-org/private-repo.git
npm ERR! 
npm ERR! Warning: Permanently added the RSA host key for IP address 'removed' to the list of known hosts.
npm ERR! git@github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
Run Code Online (Sandbox Code Playgroud)

ci.yml

name: CI

on:
  push:
    branches: [master ]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js
      uses: actions/setup-node@v1 …
Run Code Online (Sandbox Code Playgroud)

git github node.js github-actions

6
推荐指数
2
解决办法
5149
查看次数