resources.vue
1.37 KB
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
<template>
<div class="resources">
<template v-for="floor in resources">
<div class="focus" v-if="floor.focus" v-bind:style="{height: '182px'}">
<focus v-bind:floor="floor.data"></focus>
</div>
<div class="title-image" v-if="floor.titleImage">
<title-image v-bind:floor="floor.data"></title-image>
</div>
<div class="goods" v-if="floor.goods">
<goods v-bind:floor="floor.data"></goods>
</div>
</template>
</div>
</template>
<script>
const $ = require('yoho-jquery');
const tip = require('common/tip');
const focus = require('component/resources/focus.vue');
const titleImage = require('component/resources/title-image.vue');
const goods = require('component/resources/goods.vue');
module.exports = {
data() {
return {
resources: []
};
},
components: {
focus: focus,
titleImage: titleImage,
goods: goods
},
init() {
$.ajax({
url: '/resources'
}).then(result => {
this.resources = result;
}).fail(() => {
tip('网络错误');
});
}
};
</script>
<style>
.resources {
background: #f6f6f6;
}
</style>