shareItem.vue 1.06 KB
<template>
<div>
  <div class="share_item_box">
    <div v-for="(item,index) in shareItems" :key="index" @click="func(item)" class="share_item">
      <img class="left" :src="item.simg" alt=""/>
      <div class="title">{{item.title}}</div>
      <img class="right" :src="item.icon" alt=""/>
    </div>
  </div>
</div>
</template>

<script>
export default {
data () {
 return {
 }
},
//部件
 components: {
 },
//静态
 props: ["shareItems"],
//对象内部的属性监听,也叫深度监听
 watch: {
 },
//属性的结果会被缓存,除非依赖的响应式属性变化才会重新计算。主要当作属性来使用;
 computed: { 
 },
//方法表示一个具体的操作,主要书写业务逻辑;
 methods: {
  /**
     * 功能按钮
     * @param {object} shareItems [props对象]
     * @param {int} index [索引]
     */
    func(item) {
      if (typeof item.func === "function") {
        item.func(item);
      }
    }
 },
//请求数据
 created() {
},
 mounted() {
}
}
</script>

<style rel="stylesheet/less" lang="less" scoped>
@import "shareItem";
</style>