forked from alibaba/weex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.we
executable file
·53 lines (49 loc) · 1.42 KB
/
index.we
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<template>
<list>
<cell repeat="{{cases}}">
<index-item title="{{title}}" url="{{url}}"></index-item>
</cell>
</list>
</template>
<script>
// TODO ontouch highlight
module.exports = {
data: {
cases: [
{name: 'test', title: 'Test', url: ''},
{name: 'test', title: 'Test', url: ''},
{name: 'test', title: 'Test', url: ''},
{name: 'test', title: 'Test', url: ''},
{name: 'test', title: 'Test', url: ''},
{name: 'test', title: 'Test', url: ''},
{name: 'test', title: 'Test', url: ''},
{name: 'test', title: 'Test', url: ''},
{name: 'test', title: 'Test', url: ''}
]
},
created: function() {
var useLocal = true; // false when releasing
var host = '//localhost:12580';
var matches = /\/\/([^\/]+?)\//.exec(this.$getConfig().bundleUrl);
if (matches && matches.length >= 2) {
host = matches[1];
}
var localBase = '//' + host + '/test/build/';
var nativeBase = '';
var h5Base = './index.html?page=./test/build/';
// in native
var base = useLocal ? localBase : nativeBase;
// in browser or WebView
if (typeof window === 'object') {
base = h5Base;
}
for (var i in this.cases) {
var ca = this.cases[i];
ca.url = base + ca.name + '.js';
}
//nativeLog('hit', this.cases[0].url);
}
}
</script>
<style>
</style>