docs(code): 更新文档

pull/2763/head
sight 2025-07-19 19:42:10 +08:00
parent fe4d092e66
commit 0ff109ba29
1 changed files with 38 additions and 0 deletions

View File

@ -393,6 +393,44 @@ onCopy: function(code, copied){
```
</td>
</tr>
<tr>
<td>
[highlightLine](#options.highlightLine) <sup>2.12+</sup>
</td>
<td colspan="3">
<div id="options.highlightLine" lay-pid="options" class="ws-anchor">
设置行高亮,可选值:
- hl高亮
- ++diff++
- --diff--
- focus聚焦
</div>
通过 `range` 选项或注释 `[!code type:<lines>]` 指定行高亮范围
```
highlightLine: {
hl: {
range: '1,3-5,8', // 指定行高亮范围 '1,3,4,5,8'
comment: true, // 是否解析行中的高亮注释
}
}
```
```
layui.use(function(){ // [!code focus:5]
var layer = layui.layer; // [!code hl]
layer.msg('test');
})
```
</td>
</tr>
</tbody>