* zin: modify the the interaction of input of thinkchecklist wg.

This commit is contained in:
wangzemei
2024-05-11 13:35:58 +08:00
parent 93c42f2b59
commit a177928ff6
2 changed files with 9 additions and 6 deletions
+2 -2
View File
@@ -23,12 +23,12 @@ window.toggleChecked = function()
if($(this).hasClass('has-input'))
{
$(this).find('textarea').prop('disabled', !$(this).find('input').prop('checked'));
$(this).find('textarea').toggleClass('hidden', !$(this).find('input').prop('checked'));
if($(this).find('input').prop('checked')) $(this).find('textarea').trigger('focus');
}
else
{
if($(this).data('type') == 'radio') $(this).closest('.think-check-list').find('.has-input textarea').prop('disabled', true);
if($(this).data('type') == 'radio')$(this).closest('.think-check-list').find('.has-input textarea').addClass('hidden');
}
}
+7 -4
View File
@@ -38,6 +38,8 @@ class thinkCheckList extends wg
public function onBuildItem($item): wg|node
{
global $lang;
if($item instanceof item) $item = $item->props->toJSON();
if(!isset($item['checked']))
@@ -71,10 +73,11 @@ class thinkCheckList extends wg
new textarea
(
set(array(
'rows' => 1,
'disabled' => !isset($item['checked']) || !$item['checked'],
'name' => 'other',
'value' => isset($item['showText']) ? $item['showText'] : ''
'rows' => 1,
'class' => 'hidden',
'name' => 'other',
'value' => isset($item['showText']) ? $item['showText'] : '',
'placeholder' => $lang->thinkrun->placeholder->otherOption
)),
on::input('inputOther'),
on::click('stopPropagation')