小编pen*_*yal的帖子

在 tsx 文件中使用时,<use> 标签上的 xlink:href 属性会引发打字稿错误

我有简单的代码,其中包含带有<use>标签的svg 图标到使用 stencjiljs(tsx 语法)创建的 web 组件中。但是,当我xlink:href<use>标签添加属性时,我收到错误Identifier expected

Example code: 
import { Component, Prop } from '@stencil/core';

@Component({
   tag: 'example-component',
   styleUrl: 'example-component.scss',
})

 export class ExampleComponent {
     render() {
        return (
            <svg>
                <use href="#iconid" xlink:href="#iconid"/>
            </svg>
       );
    }
}
Run Code Online (Sandbox Code Playgroud)

我厌倦了寻找 tsx/jsx 特定的解决方案,但我得到的只是它xLinkHref在 React 中,在这种情况下不起作用。

我有具体的方法来做到这一点吗?

error-handling href xlink typescript tsx

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

如何制作伸展儿童并尊重最小高度的CSS网格:0?

我有简单的CSS网格.我希望它可以让孩子们尽可能地填充可用的内容,但是如果有孩子的话,也要尊重他们height: 0.现在它也为孩子"预留"空间height: 0.这是显示我的问题的小提琴:https: //jsfiddle.net/f3r0b5e9/7/

.wrapper {
  height: 300px;
  width: 200px;
  border: 1px solid red;
  display: grid;
  align-content: stretch;
  grid-template-rows: auto;
}

.child {
  width: 100%;
  border: 1px solid blue;
  background: #cad5e8;
}

.child.one {
  height: 0;
  min-height: 0;
  max-height: 0;
}
Run Code Online (Sandbox Code Playgroud)
<div class="wrapper">
  <div class="child one">
  </div>
  <div class="child two">
  </div>
  <div class="child three">
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

以下是我要完成的工作:http: //prntscr.com/kqcry4

注意:我知道如何使用flexbox :)

谢谢!

html css css3 css-grid

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

标签 统计

css ×1

css-grid ×1

css3 ×1

error-handling ×1

href ×1

html ×1

tsx ×1

typescript ×1

xlink ×1