wnetinternet-studio / yii2-libs
为Yii2提供的一些有用的库。例如,一个简化处理AJAX、模态框和从JavaScript代码显示消息的助手
v1.17.22
2024-07-17 18:17 UTC
Requires
- yiisoft/yii2: *
- dev-master
- v1.17.22
- v1.17.21
- v1.17.20
- v1.17.19
- v1.17.18
- v1.17.17
- v1.17.16
- v1.17.15
- v1.17.14
- v1.17.13
- v1.17.12
- v1.17.11
- v1.17.10
- v1.17.9
- v1.17.8
- v1.17.7
- v1.17.6
- v1.17.5
- v1.17.4
- v1.17.3
- v1.17.2
- v1.17.1
- v1.17.0
- v1.16.6
- v1.16.5
- v1.16.4
- v1.16.3
- v1.16.2
- v1.16.1
- v1.16.0
- v1.15.1
- v1.15.0
- v1.14.6
- v1.14.5
- v1.14.4
- v1.14.3
- v1.14.2
- v1.14.1
- v1.14.0
- v1.13.0
- v1.12.2
- v1.12.1
- v1.12.0
- v1.11.1
- v1.11.0
- v1.10.2
- v1.10.1
- v1.10.0
- v1.9.0
- v1.8.2
- v1.8.1
- v1.8.0
- v1.7.46
- v1.7.45
- v1.7.44
- v1.7.43
- v1.7.42
- v1.7.41
- v1.7.40
- v1.7.39
- v1.7.38
- v1.7.37
- v1.7.36
- v1.7.35
- v1.7.34
- v1.7.33
- v1.7.32
- v1.7.31
- v1.7.30
- v1.7.29
- v1.7.28
- v1.7.27
- v1.7.26
- v1.7.25
- v1.7.24
- v1.7.23
- v1.7.22
- v1.7.21
- v1.7.20
- v1.7.19
- v1.7.18
- v1.7.17
- v1.7.16
- v1.7.15
- v1.7.14
- v1.7.13
- v1.7.12
- v1.7.11
- v1.7.10
- v1.7.9
- v1.7.8
- v1.7.7
- v1.7.6
- v1.7.5
- v1.7.4
- v1.7.3
- v1.7.2
- v1.7.1
- v1.7.0
- v1.6.56
- v1.6.55
- v1.6.54
- v1.6.53
- v1.6.52
- v1.6.51
- v1.6.50
- v1.6.49
- v1.6.48
- v1.6.47
- v1.6.46
- v1.6.45
- v1.6.44
- v1.6.43
- v1.6.42
- v1.6.41
- v1.6.40
- v1.6.39
- v1.6.38
- v1.6.37
- v1.6.36
- v1.6.35
- v1.6.34
- v1.6.33
- v1.6.32
- v1.6.31
- v1.6.30
- v1.6.29
- v1.6.28
- v1.6.27
- v1.6.26
- 1.6.25
- v1.6.24
- v1.6.23
- v1.6.22
- v1.6.21
- v1.6.20
- v1.6.19
- v1.6.18
- v1.6.17
- v1.6.16
- v1.6.15
- v1.6.14
- v1.6.13
- v1.6.12
- v1.6.11
- v1.6.10
- v1.6.9
- v1.6.8
- v1.6.7
- v1.6.6
- v1.6.5
- v1.6.4
- v1.6.3
- v1.6.2
- v1.6.1
- v1.6.0
- v1.5.5
- v1.5.4
- v1.5.3
- v1.5.2
- v1.5.1
- v1.5.0
- v1.4.1
- v1.4.0
- v1.3.11
- v1.3.10
- v1.3.9
- v1.3.8
- v1.3.7
- v1.3.6
- v1.3.5
- v1.3.4
- v1.3.3
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.0
- v1.1.0
- v1.0.0.0
- v0.3.0
- v0.2.0
- v0.1.0
This package is auto-updated.
Last update: 2024-09-17 18:41:56 UTC
README
不同的Yii2库,帮助你编写更少的代码并更好地组织。
JsHelper 用于简化处理AJAX、模态框和从JavaScript代码显示消息的常见任务。查看源代码以了解此库的目的。
请注意,此库主要用于我自己的使用,可能缺乏适当的文档和对事物整体解释,尽管我尽力以我的编码方式和写注释的方式记录一切。此外,请注意,即使我尽力保持代码向后兼容,功能也可能在没有适当通知的情况下更改。
安装
安装此扩展的首选方式是通过 composer。
首先安装Yii2,然后
composer require winternet-studio/yii2-libs
使用方法
一旦扩展安装完成,只需在您的代码中通过
<?php use winternet\yii2\JsHelper; echo JsHelper::initAjax(); //call within <body> echo JsHelper::standardModal(['id' => 'StandardModal2']); ?>
JavaScript代码
// To make an AJAX call: appJS.ajax({ url: '/your/url', type: 'POST', dataType: 'json', data: {var1: 'something', var2: 'something else'} }); // To show a standard modal (either initAjax() or initModal() must have been called beforehand): appJS.showModal('Here goes the <b>content</b> for your modal.'); // To show a modal, specifying more options: appJS.showModal({ title: 'Modal title goes here', html: 'Here goes the <b>content</b> for your modal.', customModalSelector: '#StandardModal2', openCallback: function(modalRef) { // code for before modal is being opened // NOTE: not reexecuted when a closed modal is shown again (set up standard Bootstrap modal events for that) }, openedCallback: function(modalRef) { // code for after modal has been opened // NOTE: not reexecuted when a closed modal is shown again (set up standard Bootstrap modal events for that) }, closeCallback: function(modalRef) { // code for before modal is being closed // NOTE: not reexecuted when a closed modal is shown again (set up standard Bootstrap modal events for that) }, closedCallback: function(modalRef) { // code for after modal has been closed // NOTE: not reexecuted when a closed modal is shown again (set up standard Bootstrap modal events for that) } });
查看源代码以了解如何以及为什么使用这些库。