1.2.4 • Published 4 years ago

vue-sample-toast v1.2.4

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

vue-simple-toast

toast组件,适用于uni-app。

说明

项目说明 基于 wepy-simple-toast(该项目适用于wepy,原作者为:jardenliu)

因wepy2.x bug太多,导致公司的小程序迭代速度太慢,因此使用uni-app进行开发,原项目toast效果合适,进行修改成vue的项目,保留了其原有参数。(基本上是搬运了,感觉我好颓废~)

我是新手,vue爱好者。

使用

安装组件

  npm i vue-sample-toast

一、全局引入

// main.js 全局引入
import toast from 'vue-simple-toast';
Vue.component('toast',toast);

// template
<template>
  <view>
  
    //这里是你的页面内容...
    <toast ref="toast"/> //注意 ref
  </view>
</template>

<script>

export default {
  //
  methods: { 
	  // args1 => title ,标题内容
	  // args2 => Object , 可以定义对象
	  this.$successTip("title", { duration: 5000 })
  }
 }
</script>

二、局部引入

// template
<template>
  <view>
  
    //这里是你的页面内容...
    <toast ref="toast"/> //注意 ref
  </view>
</template>

<script>
import toast from "vue-sample-toast" //局部安装

export default {
  //
components: {
	toast: toast,	//局部声明
},
	
  methods: { 
	  // args1 => title ,标题内容
	  // args2 => Object , 可以定义对象
	  // 局部调用
	  this.$refs.toast.success("In face, I am a title", { duration: 5000 }))
  }
 }
</script>

调用方法

	// 全局方法
	this.$successTip(title, options);
	this.$infoTip(title, options);
	this.$warningTip(title, options);
	this.$errorTip(title, options);
	
	//或
	this.$ref.toast.success(title, options);
	this.$ref.toast.info(title, options);
	this.$ref.toast.warning(title, options);
	this.$ref.toast.error(title, options);
	
  1. options 参数当前只有 duration(显示的时长)
1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago