小编Aza*_*zin的帖子

新闻上的可触摸不透明度在 SVG 标签内不起作用

我有一个组件,里面<Svg>有一个按钮(<TouchableOpacity>with <View>)。

虽然按钮onClick独立工作正常,但当我将组件包装在 SVG 中时它不起作用。

<Svg width={'100%'} height={'100%'} viewBox='0 0 360 243' {...props}>
  <Defs>
    <LinearGradient
        id='prefix__b'
        x1={'75.7%'}
        y1={'34.3%'}
        x2={'84.6%'}
        y2={'-9.6%'}
        gradientUnits='objectBoundingBox'
    >
      <Stop offset={1} stopColor='#2ff290' />
    </LinearGradient>
  </Defs>
  <View >
    <TouchableOpacity
                      onPress={() => {
      console.log('DSDA')
      }}
      ><Text>Click me!!</Text>
    </TouchableOpacity>
  </View>
</Svg>
Run Code Online (Sandbox Code Playgroud)

https://github.com/react-native-community/react-native-svg/issues/1050

javascript svg reactjs react-native

14
推荐指数
1
解决办法
1233
查看次数

React - useMemo 有一个复杂的表达式 - 将其提取到一个单独的变量,以便可以静态检查

我正在尝试使用useMemo,但我收到了来自 lint 的消息:

React Hook useMemo 在依赖项数组中有一个复杂的表达式。将其提取到一个单独的变量中,以便可以静态检查react-hooks/exhaustive-deps。

会是什么呢?

const [selectedDate, setSelectedDate] = useState("Escolha uma data para pagamento");
const itens = useMemo(() => {
  if (!contrato.propostas || contrato.propostas.length == 0) return [];
  let dates = contrato.propostas.map(p => p.vencimento)
  dates = Array.from(new Set(dates)).map((item) => ({
    id: item,
    option: item
  }))
  if (dates.length === 1 && selectedDate !== contrato.filterByDate) setSelectedDate(dates[0].option)
  if (contrato.filterByDate && dates.find(d => d.id === contrato.filterByDate) !== -1) setSelectedDate(contrato.filterByDate);
  return dates;
}, [JSON.stringify(contrato.propostas), contrato.filterByDate, selectedDate])
Run Code Online (Sandbox Code Playgroud)

contratocontrato.propostas是对象。 …

javascript reactjs react-hooks

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

如何从 POSIXct 元素中提取正确的日期?

如何从代码的第一列中获取正确的日期?

test <- data.frame(posixdate = c("2013-05-01 00:59:00", "2013-05-01 01:59:00", "2013-05-01 02:59:00", "2013-05-01 03:59:00"))
test$posixdate <- as.POSIXct(test$posixdate, format="%Y-%m-%d %H:%M:%S" )
test$date <- as.Date(test$posixdate)
Run Code Online (Sandbox Code Playgroud)

上面的代码导致:

  posixdate           date
1 2013-05-01 00:59:00 2013-04-30
2 2013-05-01 01:59:00 2013-04-30
3 2013-05-01 02:59:00 2013-05-01
4 2013-05-01 03:59:00 2013-05-01
Run Code Online (Sandbox Code Playgroud)

前两个日期不正确。我做错了什么?
如果as.Date()不是正确的功能,我怎样才能获得日期(没有小时、分钟、秒)?

posix r posixct as.date

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

菜单切换与内部选项仅使用 CSS

我正在尝试创建一个带有选项的菜单。我只使用 CSScheckboxradio输入。

通过更改选项之一,我还希望关闭菜单。我尝试使用labelinside label,但它不起作用。我的原型代码:

input {
  display: none;
}

label {
  cursor: pointer;
}

label span:hover {
  font-weight: 600;
}

.opener .menu {
  background-color: #f3f3f3;
  display: flex;
  flex-direction: column;
  color: #4d4d4d;
  padding: 12px 4px;
  width: 270px;
}

#menu:checked~.opener .menu {
  display: none;
}

#menu~.opener>span:nth-of-type(1) {
  display: none;
}

#menu:~.opener>span:nth-of-type(2) {
  display: block;
}

#menu:checked~.opener>span:nth-of-type(1) {
  display: block;
}

#menu:checked~.opener>span:nth-of-type(2) {
  display: none;
}

.box {
  height: 50px;
  width: 50px;
  margin: 20px 0;
} …
Run Code Online (Sandbox Code Playgroud)

html css

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

如何使 swiper 滑块不扩展其父块?

我有两列布局。侧边栏具有固定宽度。右侧应该垂直增长,但不应该在水平方向。Flexbox 模型打破了我的大脑。如何使 swiper carousel 不扩展父块?

在 Codepen 中,您看不到这一点,但浏览器中会出现水平滚动条。尝试调整窗口大小 - 发生了一些奇怪的事情,它会越来越大。

再一次。我需要右侧(alt-right 及其所有内容)不要在水平方向上扩展。我需要为 alt-right 和 alt-sidebar 设置相同的高度(如果它们是空的,高度应该垂直适合屏幕)。

<div class="alt-wrapper">
  <div class="alt-top">
    <div class="alt-sidebar">
      ff
    </div>
    <div class="alt-right">
      <div class="alt-header">
        f
      </div>
      <div class="alt-content">
        <div class="swiper-container">
          <!-- Additional required wrapper -->
          <div class="swiper-wrapper">
            <!-- Slides -->
            <div class="swiper-slide">
              <div style="background-color: darkolivegreen">afas</div>
            </div>
            <div class="swiper-slide">
              <div style="background-color: darkolivegreen">afas</div>
            </div>
            <div class="swiper-slide">
              <div style="background-color: darkolivegreen">afas</div>
            </div>
            <div class="swiper-slide">Slide 2</div>

            <div class="swiper-slide">
              <div style="background-color: darkolivegreen">afas</div>
            </div>
          </div>
          <!-- If we need pagination -->
          <div class="swiper-pagination"></div> …
Run Code Online (Sandbox Code Playgroud)

html css flexbox swiper

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

如何获取鼠标点击div的宽度?

我想使用 HTML/CSS/JS 将<div>其颜色更改为仅达到一定的宽度。该特定长度取决于在 .txt 文件中单击的位置<div>

例子:

我想要的图片

我会给出代码,但它只是一个<div>.
我不知道如何使用 CSS/JS 来检测鼠标点击的位置<div>(即宽度大小)。

html javascript css jquery

5
推荐指数
2
解决办法
3530
查看次数

在检索行时,MYSQL 中的 AND、OR 运算符有什么区别?

这些查询及其执行方式之间是否存在差异?

SELECT   customername, country, creditLimit
FROM   customers
WHERE (country = 'USA' OR country = 'France') AND creditlimit > 100000;
Run Code Online (Sandbox Code Playgroud)
SELECT    customername, country, creditLimit
FROM    customers
WHERE country = 'USA' OR country = 'France' AND creditlimit > 10000;
Run Code Online (Sandbox Code Playgroud)

mysql sql logical-operators

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