前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >专栏 >iView使用中的注意项

iView使用中的注意项

作者头像
码客说
发布2021-11-12 18:08:41
发布2021-11-12 18:08:41
1.1K00
代码可运行
举报
文章被收录于专栏:码客码客
运行总次数:0
代码可运行

官网

https://www.iviewui.com/components/table

Table

代码语言:javascript
代码运行次数:0
运行
复制
<template>
  <div>
    <Table border :columns="table_header" :data="table_data">
      <template slot-scope="{ row }" slot="name">
        <strong>{{ row.name }}</strong>
      </template>
      <template slot-scope="{ row, index }" slot="action">
        <Button
          type="primary"
          size="small"
          style="margin-right: 5px"
          @click="show(index)"
          >查看</Button
        >
        <Button type="error" size="small" @click="remove(index)">删除</Button>
      </template>
    </Table>
  </div>
</template>

<script>
export default {
  name: "assess_detail",
  data: function() {
    return {
      table_header: [
        {
          title: "Name",
          slot: "name"
        },
        {
          title: "Age",
          key: "age"
        },
        {
          title: "Address",
          key: "address"
        },
        {
          title: "Action",
          slot: "action",
          width: 150,
          align: "center"
        }
      ],
      table_data: [
        {
          name: "John Brown",
          age: 18,
          address: "New York No. 1 Lake Park"
        },
        {
          name: "Jim Green",
          age: 24,
          address: "London No. 1 Lake Park"
        },
        {
          name: "Joe Black",
          age: 30,
          address: "Sydney No. 1 Lake Park"
        },
        {
          name: "Jon Snow",
          age: 26,
          address: "Ottawa No. 2 Lake Park"
        }
      ]
    };
  },
  methods: {
    show(index) {
      this.$Modal.info({
        title: "User Info",
        content: `Name:${this.data6[index].name}<br>Age:${this.data6[index].age}<br>Address:${this.data6[index].address}`
      });
    },
    remove(index) {
      this.data6.splice(index, 1);
    }
  }
};
</script>

Page

代码语言:javascript
代码运行次数:0
运行
复制
<template>
  <div>
    <Page
      :current="table_page.current"
      :page-size="table_page.page_size"
      :page-size-opts="table_page.page_size_opts"
      :total="table_page.total"
      prev-text="上一页"
      next-text="下一页"
      show-elevator
      show-sizer
      show-total
    />
  </div>
</template>

<script>
export default {
  name: "assess_detail",
  data: function() {
    return {
      table_page: {
        current: 1,
        page_size: 10,
        page_size_opts: [10, 20, 30],
        total: 100
      }
    };
  },
  methods: {

  }
};
</script>

弹窗

代码语言:javascript
代码运行次数:0
运行
复制
<Modal
       v-model="show_detail_dialog"
       width="800"
       draggable
       sticky
       scrollable
       :mask="false"
       title="我是标题"
       >

</Modal>

提示信息

代码语言:javascript
代码运行次数:0
运行
复制
this.$Message.info(res.msg);
this.$Message.warning(res.msg);
this.$Message.success(res.msg);
this.$Message.error(res.msg);

加载中

代码语言:javascript
代码运行次数:0
运行
复制
const msg = this.$Message.loading({
    content: 'Loading...',
    duration: 0
});

取消加载中

代码语言:javascript
代码运行次数:0
运行
复制
setTimeout(msg, 3000);

或者用全局销毁

代码语言:javascript
代码运行次数:0
运行
复制
this.$Message.destroy();
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2021-10-30,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 官网
  • Table
  • Page
  • 弹窗
  • 提示信息
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档