1# line 2 3 4> **说明:** 5> 该组件从API version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 6 7绘制线条。 8 9## 权限列表 10 11无 12 13 14## 子组件 15 16支持[animate](js-components-svg-animate.md)、[animateMotion](js-components-svg-animatemotion.md)、[animateTransform](js-components-svg-animatetransform.md)。 17 18 19## 属性 20 21支持Svg组件[通用属性](js-components-svg-common-attributes.md)和以下属性。 22 23| 名称 | 类型 | 默认值 | 必填 | 描述 | 24| -------- | -------- | -------- | -------- | -------- | 25| id | string | - | 否 | 组件的唯一标识。 | 26| x1 | <length>\|<percentage> | - | 否 | 设置线条起点的x轴坐标。支持属性动画。 | 27| y1 | <length>\|<percentage> | - | 否 | 设置线条起点的y轴坐标。支持属性动画。 | 28| x2 | <length>\|<percentage> | - | 否 | 设置线条终点的x轴坐标。支持属性动画。 | 29| y2 | <length>\|<percentage> | - | 否 | 设置线条终点的y轴坐标。支持属性动画。 | 30 31 32## 示例 33 34```html 35<!-- xxx.hml --> 36<div class="container"> 37 <svg width="400" height="400"> 38 <line x1="10" x2="300" y1="50" y2="50" stroke-width="4" fill="white" stroke="blue"></line> 39 <line x1="10" x2="300" y1="100" y2="100" stroke-width="4" fill="white" stroke="blue"></line> 40 <line x1="10" x2="300" y1="150" y2="150" stroke-width="10" stroke="red" stroke-dasharray="5 3" 41 stroke-dashoffset="3"></line> 42 <!--round:在路径的末端延伸半个圆,直径等于线宽--> 43 <line x1="10" x2="300" y1="200" y2="200" stroke-width="10" stroke="black" stroke-linecap="round"></line> 44 <!--butt:不在路径两端扩展--> 45 <line x1="10" x2="300" y1="220" y2="220" stroke-width="10" stroke="black" stroke-linecap="butt"></line> 46 <!-- square:在路径的末端延伸一个矩形,宽度等于线宽的一半,高度等于线宽 --> 47 <line x1="10" x2="300" y1="240" y2="240" stroke-width="10" stroke="black" stroke-linecap="square"></line> 48 </svg> 49</div> 50``` 51 52 53 54