UNPKG

1.4 kBJavaScriptView Raw
1(function() {
2 'use strict';
3
4 window.Ractive.controller('index-content', function(component, data, el, config, done) {
5
6 var Content = component({
7 data: $.extend(true, {
8 searchChange: function(event, value) {
9 if (value == 'a') {
10 Content.set('searchList', [{
11 value: 'abbb',
12 display: 'a<strong>bbb</strong>'
13 }, {
14 value: 'aa',
15 display: 'a<strong>a</strong>'
16 }, {
17 value: 'aaaa',
18 display: 'a<strong>aaa</strong>'
19 }, {
20 value: 'aabb',
21 display: 'a<strong>abb</strong>'
22 }, {
23 value: 'accc',
24 display: 'a<strong>ccc</strong>'
25 }, {
26 value: 'addd',
27 display: 'a<strong>ddd</strong>'
28 }]);
29 }
30 else if (value == 'aa') {
31 Content.set('searchList', [{
32 value: 'aaaa',
33 display: 'a<strong>aaa</strong>'
34 }, {
35 value: 'aabb',
36 display: 'a<strong>abb</strong>'
37 }]);
38 }
39 else {
40 Content.set('searchList', null);
41 }
42 },
43
44 searchSelect: function(event, value) {
45 console.log('Search Select:', value);
46 }
47 }, data)
48 });
49
50 Content.require().then(done);
51 });
52
53})();