|
@@ -2,7 +2,7 @@
|
|
|
<div class="linkbox">
|
|
|
<span>友情链接</span>
|
|
|
<div class="imgbox">
|
|
|
- <a v-for="(item, index) in list" :key="index" :href="item.links">
|
|
|
+ <a v-for="(item, index) in linkList" :key="index" :href="item.links">
|
|
|
<img class="item" :src="item.path" :alt="item.name">
|
|
|
</a>
|
|
|
</div>
|
|
@@ -10,48 +10,27 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { createNamespacedHelpers } from 'vuex'
|
|
|
+const { mapState, mapActions } = createNamespacedHelpers('links')
|
|
|
export default {
|
|
|
components: {},
|
|
|
data () {
|
|
|
- return {
|
|
|
- list: [
|
|
|
- {
|
|
|
- name: '友情链接1',
|
|
|
- path: require('../../assets/foot/y1.png'),
|
|
|
- links: 'http://baidu.com'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '友情链接2',
|
|
|
- path: require('../../assets/foot/y2.png'),
|
|
|
- links: 'http://youku.com'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '友情链接3',
|
|
|
- path: require('../../assets/foot/y3.png'),
|
|
|
- links: 'http://taobao.com'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '友情链接4',
|
|
|
- path: require('../../assets/foot/y4.png'),
|
|
|
- links: 'http://4399.com'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '友情链接2',
|
|
|
- path: require('../../assets/foot/y2.png'),
|
|
|
- links: 'http://youku.com'
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
+ return {}
|
|
|
},
|
|
|
methods: {
|
|
|
+ ...mapActions(['getlink']),
|
|
|
times () {
|
|
|
- const a = this.list[0]
|
|
|
- this.list.splice(0, 1)
|
|
|
- this.list.push(a)
|
|
|
+ const a = this.linkList[0]
|
|
|
+ this.linkList.splice(0, 1)
|
|
|
+ this.linkList.push(a)
|
|
|
}
|
|
|
},
|
|
|
- mounted () {
|
|
|
- setInterval(this.times, 2000)
|
|
|
+ async mounted () {
|
|
|
+ await this.getlink()
|
|
|
+ setInterval(this.times, 5000)
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['linkList'])
|
|
|
}
|
|
|
}
|
|
|
</script>
|