yii2-sweet-alert icon indicating copy to clipboard operation
yii2-sweet-alert copied to clipboard

定时关闭问题

Open luopeihai opened this issue 6 years ago • 0 comments

实现效果:定时关闭alert, Alert 代码: ........ echo \yii2mod\alert\Alert::widget([ 'useSessionFlash' => false, 'options' => [ 'timer' => null, 'type' => $type, 'title' => $message, 'timer'=> 1500, // 'showConfirmButton'=> false ] ]); ....... 发现并没有自动关闭,查看 源码 yii2mod/yii2-sweet-alert/Alert.php文件

...... protected function registerAssets() { if ($this->hasTitle()) { $view = $this->getView(); AlertAsset::register($view); //var_dump($this->getOptions());exit; $js = "sweetAlert({$this->getOptions()}, {$this->callback});"; $view->registerJs($js, $view::POS_END); } } ....... 把 $js = "sweetAlert({$this->getOptions()}, {$this->callback});"; 改为
$js = "sweetAlert({$this->getOptions()});"; 定时效果搞定

luopeihai avatar Jul 06 '18 09:07 luopeihai