Browse Source

更新 code 用例

pull/1368/head
贤心 1 year ago
parent
commit
796a064e09
  1. 22
      examples/code.html

22
examples/code.html

@ -191,27 +191,24 @@ layui.use(['code', 'dropdown'], function(){
'full', 'full',
{ {
title: ['文字换行'], title: ['文字换行'],
type: 'form' type: 'form',
}, event: function(obj) {
{
title: ['切换高亮主题'],
type: 'theme'
}
],
toolsEvent: function(obj) {
if (obj.type === 'form') {
dropdown.render({ dropdown.render({
elem: obj.elem, elem: obj.elem,
data: [{title: '自动换行', wordWrap: true}, {title: '不自动换行', wordWrap: false}], data: [{title: '自动换行', wordWrap: true}, {title: '不自动换行', wordWrap: false}],
show: true, show: true,
click: function(data, othis) { click: function(data, othis) {
codeInst.reload({ codeInst.reload({
wordWrap: data.wordWrap, wordWrap: data.wordWrap
content: [+new Date()]
}); });
} }
}); });
} else if (obj.type === 'theme') { }
},
{
title: ['切换高亮主题'],
type: 'theme',
event: function(obj) {
dropdown.render({ dropdown.render({
elem: obj.elem, elem: obj.elem,
data: themeData, data: themeData,
@ -248,6 +245,7 @@ layui.use(['code', 'dropdown'], function(){
}); });
} }
} }
]
}); });
// 仅重载 code // 仅重载 code

Loading…
Cancel
Save