vue翻页组件

1.SlideDemo.vue

<template>
  <div class="yh-page">
    <h1>Slide 演示</h1>
    <div class="desc">
      Demo源代码:
      <code>/examples/components/modules/BlockHeaderDemo.vue</code>
    </div>
    <div class="yh-block">
      <div>
        <table style="width:320px;background-color:#ececec" cellpadding="5px">
          <tr>
            <td style="height:50px;font-weight:bold;width:60px">标题:</td>
            <td>{{pageData.title}}</td>
          </tr>
          <tr>
            <td style="height:200px;font-weight:bold">正文:</td>
            <td>{{pageData.text}}</td>
          </tr>
        </table>
        <div style="width:300px;text-align:center;margin-top:5px;">
          <yh-button @click="onPrevClick" class="yh-icon" style="color:#999">◁</yh-button>
          <span>第{{page + 1}}/{{pages.length}}个</span>
          <yh-button @click="onNextClick" class="yh-icon" style="color:#999">▷</yh-button>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import yhbutton from "../../components/comcompont/Button";
export default {
  name: "SlideDemo",
  data() {
    return {
      pages: [
        {
          title: "Title 1",
          text:
            "与现实生活一致:与现实生活的流程、逻辑保持一致,遵循用户习惯的语言和概念;在界面中一致:所有的元素和结构需保持一致,比如:设计样式、图标和文本、元素的位置等。"
        },
        {
          title: "Title 2",
          text:
            "控制反馈:通过界面样式和交互动效让用户可以清晰的感知自己的操作;页面反馈:操作后,通过页面元素的变化清晰地展现当前状态。"
        },
        {
          title: "Title 3",
          text: "Text"
        }
      ],
      page: 0
    };
  },
  computed: {
    pageData: function() {
      return this.pages[this.page];
    }
  },
  methods: {
    onPrevClick() {
      var p = this.page;
      if (p > 0) {
        this.page = p - 1;
      }
    },
    onNextClick() {
      var p = this.page;
      if (p < this.pages.length - 1) {
        this.page = p + 1;
      }
    }
  },
  components: {
    "yh-button": yhbutton
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scope>
</style>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值