浏览代码

update actions

update
jqh 5 年之前
父节点
当前提交
833584aa39
共有 2 个文件被更改,包括 10 次插入6 次删除
  1. 4 5
      src/Actions/Action.php
  2. 6 1
      src/Actions/HasActionHandler.php

+ 4 - 5
src/Actions/Action.php

@@ -68,14 +68,13 @@ abstract class Action implements Renderable
     /**
      * Action constructor.
      *
-     * @param mixed  $key
      * @param string $title
      */
-    public function __construct($key = null, $title = null)
+    public function __construct($title = null)
     {
-        $this->setKey($key);
-
-        $this->title = $title;
+        if ($title) {
+            $this->title = $title;
+        }
     }
 
     /**

+ 6 - 1
src/Actions/HasActionHandler.php

@@ -156,7 +156,7 @@ JS;
     protected function resolverScript()
     {
         return <<<JS
-function (data, target) {
+function (data) {
     var response = data[0],
         target   = data[1];
         
@@ -178,6 +178,11 @@ function (data, target) {
             case 'location':
                 window.location = then.value;
                 break;
+            case 'script':
+                (function () {
+                    eval(then.value);
+                })();
+                break;
         }
     };