小编Abo*_*kar的帖子

如何在 vue 组合 api 组件中使用 jest 进行单元测试?

我正在用 jest 为 vue.js 中的组合 API 组件编写单元测试。

但是我无法访问组合 API 的 setup() 中的函数。

指标.vue

<template>
  <div class="d-flex flex-column justify-content-center align-content-center">
    <ul class="indicator-menu d-flex justify-content-center">
      <li v-for="step in steps" :key="step">
        <a href="#" @click="updateValue(step)" :class="activeClass(step, current)"> </a>
      </li>
    </ul>
    <div class="indicator-caption d-flex justify-content-center">
      step
      <span> {{ current }}</span>
      from
      <span> {{ steps }}</span>
    </div>
  </div>
</template>

<script lang="ts">
import {createComponent} from '@vue/composition-api';

export default createComponent({
  name: 'Indicator',
  props: {
    steps: {
      type: Number,
      required: true
    },
    current: {
      type: Number,
      required: true
    } …
Run Code Online (Sandbox Code Playgroud)

unit-testing typescript vue.js jestjs vue-composition-api

15
推荐指数
1
解决办法
4241
查看次数

How to get all of the pasted string, in input which has a maxLength attribute?

I need to get all of the pasted string in input which has a maxLength attribute.

But in 'onpaste' event there is no property to get all of the pasted string.

For example, check below snippet with this string:

"AAAAA-BBBBB-BBBBB-BBBBB-BBBBB"

The output is : "AAAAA"

But I need all of the string.

const onPasteFn = (e) => {
  setTimeout(() => document.getElementById("demo").innerHTML = e.target.value, 0)
}
Run Code Online (Sandbox Code Playgroud)
<input type="text" maxLength="5" onpaste="onPasteFn(event)" />

<p id="demo"></p>
Run Code Online (Sandbox Code Playgroud)

html javascript string clipboard paste

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

在背景上带有透明边框的圆圈

我怎样才能在 CSS 中实现这样的事情?

目标

我已经尝试了很多方法,但深色背景仍然挡住了并且无法剪裁,因此它下面的背景图像不可见......

.item {
  position: relative;
}
    
.item:before {
  content: '';
  size(100%);
  top: 0;
  left: 0;
  z-index: 1;
  background: rgba(0, 0, 0,0 0.1);
}
Run Code Online (Sandbox Code Playgroud)
<div class="item">
   <img>
   <span class="rate">
     <span class="amount">10</span> ??????
   </span>
</div>  
Run Code Online (Sandbox Code Playgroud)

我正在寻找一种能够使部分深色背景透明的方法,以便可以看到图像。

html css transparency

9
推荐指数
2
解决办法
337
查看次数

禁用特定页面上的滚动

有什么办法可以禁用单个页面上的滚动吗?我尝试在特定页面上进行设置overflow: hidden,但没有成功。我必须将其设置在正文上index.css才能使其正常工作,但这显然会禁用所有页面上的滚动。所以我想到的唯一方法是在 body 上有条件地设置 CSS 类。有没有办法根据 redux 存储中的值有条件地在 index.js 中设置 CSS 类,或者还有其他方法吗?

我的索引.js

import React from 'react';
import ReactDOM from 'react-dom';
import {BrowserRouter} from 'react-router-dom'
import {Provider} from 'react-redux'
import {createStore,applyMiddleware,compose,combineReducers} from "redux";
import thunk from 'redux-thunk'
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import authReducer from './store/reducers/auth'

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

const rootReducer = combineReducers({
   auth: authReducer
})

const store = createStore(rootReducer,
   composeEnhancers(applyMiddleware(thunk)));

const app =(
   <Provider store={store}> …
Run Code Online (Sandbox Code Playgroud)

css reactjs

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

如何在圆的边缘放置图标

我想将图标放置在其父级(圆圈)的边缘,如下所示:

在此处输入图片说明

我尝试了一些方法,但默认情况下绝对子级放置在其父级的起始位置,如下所示:

在此处输入图片说明

甚至父级也有一个圆形 ( border-radius: 50%;)

我不想使用marginposition为每个孩子,因为他们的数量是动态的。

有没有办法将孩子放在父母的边缘?

.circle {
  position: relative;
  width: 300px;
  height: 300px;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  border-radius: 50%;
}

.menu {
  list-style-type: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0;
  margin: 0;
  position: absolute;
  right: 5px;
}

.menu li {
  margin: 5px 0;
}

.menu li a {
  display: block;
}

.menu li a img {
  width: 50px;
}
Run Code Online (Sandbox Code Playgroud)
<div class="circle">
  <ul class="menu">
    <li>
      <a …
Run Code Online (Sandbox Code Playgroud)

html css css-position flexbox

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

Azure数据工厂实体依赖关系查找

我们如何找出各种 ADF 实体(例如管道、数据集和链接服务)之间的依赖关系?

示例:我有一个数据集 DS_ASQL_DB。我们如何检查此数据集是否正在任何 ADF 管道中使用/引用?

azure-data-factory

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