vue 移动端UI组件/项目 (mint-ui;mui)

本文详细介绍Mint-UI库的使用,包括如何通过Mint-UI实现自定义样式的Toast弹窗效果,以及如何应用LazyLoad组件进行图片懒加载,优化页面性能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Mint-UI—Toast

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <!-- import CSS -->
  <link rel="stylesheet" href="https://unpkg.com/mint-ui/lib/style.css">
  <script src="https://unpkg.com/vue/dist/vue.js"></script>
  <!-- import JavaScript -->
  <script src="https://unpkg.com/mint-ui/lib/index.js"></script>
  <style type="text/css">
      .mytoast{
      color:#e4393c;         /*红色文字*/
      background-color: #fff;/*白色背景*/
      font-size:12px;          /*字体*/
      border:1px solid #aaa; /*边框*/
    }
  </style>
</head>
<body>
  <div id="app">
    <mt-button @click.native="handleClick">Button</mt-button>
  </div>
</body>
  <!-- import Vue before Mint UI -->
  
  <script>
    new Vue({
      el: '#app',
      //点击出现弹框
      methods: {
        handleClick: function() {
          this.$toast({
          message: 'Upload Complete',
          position: 'bottom',
          duration: 5000,
           className:"mytoast"  

          });
        }
      },
      //直接出现弹框
      //   created(){
      //  let instance= this.$toast({
      //   message: 'Upload Complete',
      //   position: 'bottom',
      //   duration: -1
      // });
        
      //   setTimeout(() => {
      //     instance.close();
      //   }, 2000);
      // }

      //   }
    })
  </script>
</html>

在这里插入图片描述

Mint-UI—LazyLoad

知识点
懒加载图片组件

img[lazy=loading]{ width:40px; height:100px; margin:auto; } #### 实际的应用: ``` Document
<script>
  new Vue({
    el:"#app",
    data:function(){
      return {
        list:
          ["img/01.jpg",
          "img/02.jpg",
          "img/03.jpg",
          "img/04.jpg"
          ]
      }
    }
  });
</script>
```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值