Jelajahi Sumber

update select2 example

Evan You 10 tahun lalu
induk
melakukan
04df2c0f7d
1 mengubah file dengan 4 tambahan dan 6 penghapusan
  1. 4 6
      examples/select2/index.html

+ 4 - 6
examples/select2/index.html

@@ -25,16 +25,14 @@
     <script>
     Vue.directive('select', {
       twoWay: true,
+
+      params: ['options'],
+
       bind: function () {
-        var optionsData
-        var optionsExpression = this.param('options')
-        if (optionsExpression) {
-          optionsData = this.vm.$eval(optionsExpression)
-        }
         var self = this
         $(this.el)
           .select2({
-            data: optionsData
+            data: this.params.options
           })
           .on('change', function () {
             self.set(this.value)