小编shi*_*shi的帖子

有没有更短的方法只在一侧写边框?

我通过执行以下操作在所有边缘上设置了边框:

这实际上是一个错误,但在提出问题时,我相信我可以使用以下代码仅在顶部画一条线。(实际上,线条是在所有边缘上绘制的。)

<div class="border border-blue-900 border-t-1">foo</div>
Run Code Online (Sandbox Code Playgroud)

我只想在一侧显示它,所以我做了一些研究。我注意到当我使用borderin时tailwindcss,输出文件中输出了以下内容。

/**

    1. 防止内边距和边框影响元素宽度。
  • 我们曾经在 html 元素中设置它并继承自
  • 其他所有内容的父元素。这引起了问题
  • 在 Shadow-dom 增强的元素中,例如内容
  • 由一个 div 包裹,且 box-sizing 设置为content-box
  • https://github.com/mozdevs/cssremedy/issues/4
    1. 允许仅通过添加边框宽度来向元素添加边框。
  • 默认情况下,浏览器指定元素不应该有的方式
  • none边框是通过在用户代理中将其边框样式设置为
  • 样式表。
  • 只需设置即可轻松为元素添加边框border-width
  • 属性,我们将所有元素的默认边框样式更改为solid, 和
  • 使用 border-width 来隐藏它们。这样我们的border公用事业就只剩下
  • 需要设置border-width属性而不是整个border
  • 速记,使我们的边界实用程序更容易编写。
  • https://github.com/tailwindcss/tailwindcss/pull/116 */

此输出的原始版本来自 https://github.com/tailwindlabs/tailwindcss/blob/723e8d4377eb25b66a6224f767937fa02762eb52/src/plugins/css/preflight.css#L71

我想这可能就是原因。我通过编写以下内容成功地将其仅应用到顶部边缘。

<div class="border border-blue-900 border-t-1 border-l-0 border-r-0 border-b-0">foo</div>
Run Code Online (Sandbox Code Playgroud)

然而,这太长了。有什么办法可以让它变短吗?

注意:我也在考虑以下替代方案。

如何将其作为 JIT 中的参数?

这样,我还可以调整宽度(不是边框中的宽度,是 for display: block)。

我想做的只是将其显示在任意一侧,因此上面的链接试图将其显示在底部。(换句话说,无论是在顶部、底部还是其他任何地方,这只是一个例子。)

html css tailwind-css

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

如何检测用户何时到达 ScrollView 的底部?

我使用以下代码作为参考:

我认为它非常接近。似乎可以通过使用origin.maxY而不是 来解决origin.y,但origin.maxY似乎没有提供GeometryReader(严格来说CGRect:)。

如何检测用户何时到达 ScrollView 的底部?

import SwiftUI

struct ContentView: View {
  let spaceName = "scroll"

  @State var scrollViewSize: CGSize = .zero

  var body: some View {
    ScrollView {
      ChildSizeReader(size: $scrollViewSize) {
        VStack {
          ForEach(0..<100) { i in
            Text("\(i)")
          }
        }
        .background(
          GeometryReader { proxy in
            Color.clear.preference(
              key: ViewOffsetKey.self,
              value: -1 * proxy.frame(in: .named(spaceName)).origin.y
            )
          }
        )
        .onPreferenceChange( …
Run Code Online (Sandbox Code Playgroud)

ios swift swiftui

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

rake gen_deploy在Octopress被拒绝了

我在GitHub Pages中安装了Octopress.

我克隆了存储库.

$ git clone git@github.com:my-name/my-name.github.io.git

$ git checkout source

$ rake setup_github_pages

我输入了我的存储库名称.

$ rake gen_deploy

我收到了错误

! [rejected] master -> master (non-fast-forward)

我的解决方案

我解决了这个问题,在GitHub中删除my-name.github.io.git,并创建同名存储库和

$ rake gen_deploy

但我不想删除存储库

什么是最好的解决方案?

octopress

10
推荐指数
2
解决办法
2886
查看次数

使用放大手势;如何放大用户手指实际“捏合”的位置?

我在 SwiftUI 中遇到了与下面相同的问题。

使用捏合手势;如何放大用户手指实际“捏”的位置?

我想我可以通过给出两个手指的中心坐标anchor参数来解决这个问题。scaleEffect但我不知道如何到达中心。

我的代码:

import SwiftUI

struct MagnificationGestureView: View {
  @State var scale: CGFloat = 1.0
  @State var lastScaleValue: CGFloat = 1.0

  var body: some View {
    Image(
      systemName: "photo"
    )
    .resizable()
    .frame(
      width: 100,
      height: 100
    )
    .scaleEffect(
      self.scale
      //, anchor: <---- give: the two fingers center position
    )
    .gesture(
      magnification
    )
  }

  var magnification: some Gesture {
    // Can I get the center of the pinch?
    MagnificationGesture().onChanged { val in
      let delta …
Run Code Online (Sandbox Code Playgroud)

ios swift swiftui

7
推荐指数
0
解决办法
1266
查看次数

如何知道I18n轨道的优先级

我不知道config.i18n.load_pathI18n.load_path不同. /sf/ask/2301639301/

设计,国际化的视图

我使用https://github.com/mcasimir/devise-i18n-views.

目录

在此输入图像描述

我的项目有三个I18n用于用户属性.

  activerecord:
    attributes:
      user:
Run Code Online (Sandbox Code Playgroud)

config/locales/models/*.yml,config/locales/devise*.yml,gems/devise-i18n-views-0.3.5/locales/*.yml.

我认为优先考虑.

  1. 配置/区域设置/模型/*.YML
  2. 配置/区域设置/设计*.yml
  3. 宝石/设计,国际化的视图-0.3.5 /区域设置/*.YML

如何知道优先权

http://guides.rubyonrails.org/i18n.html没有说I18n的优先级.

ruby-on-rails

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

gitlab6.0,错误连接被拒绝 - 连接(2)(Errno :: ECONNREFUSED)

我安装了gitlab

我在阅读后安装了gitlab

我在浏览器的gitlab上创建了存储库,
我设置了~/.ssh/config,
然后
$ git push origin master

我得到了Erorr

/usr/local/lib/ruby/2.0.0/net/http.rb:878:in `initialize': Connection refused - connect(2) (Errno::ECONNREFUSED)
    from /usr/local/lib/ruby/2.0.0/net/http.rb:878:in `open'
    from /usr/local/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
    from /usr/local/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
    from /usr/local/lib/ruby/2.0.0/net/http.rb:877:in `connect'
    from /usr/local/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
    from /usr/local/lib/ruby/2.0.0/net/http.rb:851:in `start'
    from /home/git/gitlab-shell/lib/gitlab_net.rb:62:in `get'
    from /home/git/gitlab-shell/lib/gitlab_net.rb:17:in `allowed?'
    from /home/git/gitlab-shell/lib/gitlab_shell.rb:60:in `validate_access'
    from /home/git/gitlab-shell/lib/gitlab_shell.rb:23:in `exec'
    from /home/git/gitlab-shell/bin/gitlab-shell:16:in `<main>'
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository …
Run Code Online (Sandbox Code Playgroud)

git ssh ruby-on-rails gitlab

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

jekyll在本地工作但不工作github.要导入的文件未找到或不可读:最小值

我的守则. https://github.com/shingo-nakanishi/jekyll-dojo/tree/03e7541c602daab320b18ec7545e4259433dcaf4

jekyll在本地工作但不工作github.

页面构建失败,出现以下错误:

您的SCSS文件css/main.scss在第36行上有错误:要导入的文件未找到或不可读:最小值.有关更多信息,请参阅https://help.github.com/articles/page-build-failed-invalid-sass-or-scss.

为什么在当地工作?如何在github工作?

jekyll github-pages

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

如何防止ZStack下层View做出反应?

我使用 ZStack 编写了以下代码。这是使用 ZStack 实现的底部工作表。

我想让上层View变灰,阻止下层View的按钮响应。但下层View的按钮有反应。

这使得无法再现模态底部片材运动。

当上层视图退出时,如何防止下层视图响应?

代码:

import SwiftUI

struct ContentView: View {
  @State private var isShow = false

  var body: some View {
    ZStack {
      Button(
        "Show Sheet",
        action: {
          withAnimation {
            self.isShow.toggle()
          }
        }
      )
      .zIndex(0)

      BottomSheet(
        isShow: self.$isShow,
        content: {
          VStack {
            Text("A")
            Text("B")
            Text("C")
          }
          .frame(
            maxWidth: .infinity
          )
          .background(Color(.yellow))
        }
      )
      .zIndex(1)
    }
  }
}

struct ScrimView: View {
  var body: some View {
    VStack {}.frame(
      maxWidth: .infinity,
      maxHeight: .infinity,
      alignment: .bottom
    ) …
Run Code Online (Sandbox Code Playgroud)

ios swift swiftui

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

标签 统计

ios ×3

swift ×3

swiftui ×3

ruby-on-rails ×2

css ×1

git ×1

github-pages ×1

gitlab ×1

html ×1

jekyll ×1

octopress ×1

ssh ×1

tailwind-css ×1