定制 xbazilio/yii2-jswidget 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

xbazilio/yii2-jswidget

最新稳定版本:1.0.0

Composer 安装命令:

composer require xbazilio/yii2-jswidget

包简介

Outputs javascript code using yii\web\View::registerJs().

README 文档

README

#What is this?

A simple widget to wrap your javascript code and output it in specified position of the rendered page.

#Installation

composer require "xbazilio/yii2-jswidget":"1.0.0"

#Usage

By default it outputs code in the yii\web\View::POS_END. Pass position parameter if you want to change this behaviour.

<?php
use xBazilio\JSWidget\JSWidget;
?>

<?php JSWidget::begin(); ?>
<script type="text/javascript">
console.log('test');
</script>
<?php JSWidget::end(); ?>

If there are two widgets with the same id, the later will take precedence and overwrite the former

<?php
use xBazilio\JSWidget\JSWidget;
?>

<?php JSWidget::begin(['id' => 'test']); ?>
<script type="text/javascript">
console.log('test');
</script>
<?php JSWidget::end(); ?>

<?php JSWidget::begin(['id' => 'test']); ?>
<script type="text/javascript">
console.log('test overwritten');
</script>
<?php JSWidget::end(); ?>

Only 'test overwritten' will be logged.

统计信息

  • 总下载量: 19
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-12-05