1.1.0 • Published 4 years ago

message_tips_chen v1.1.0

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

参数 object || string

参数为object类型时
属性类型默认值是否必填说明
maskbooleantrue控制背景层
showClosebooleanfalse控制是否显示关闭按钮
titlestring标题
contentstring 或 number主题文案
confirmTextstring确定确定按钮文案
showCancelbooleanfalse是否显示取消按钮
cancelTextstring取消取消按钮文案
参数为string类型时,即为content属性

复制组件引用

复制components/message文件加 main.js内引入 import '@/components/message';

npm包引用

<!--安装-->
yarn add message_tips_chen --save
<!--main.js内引用-->
import { $messageTips, $alert, $confirm } from 'message_tips_chen';
Vue.prototype.$messageTips = $messageTips;
Vue.prototype.$alert = $alert;
Vue.prototype.$confirm = $confirm;

应用举例

<!-- 参数为string类型  -->
const res = await this.$messageTips('消息文案').catch(e => e);
if (res === 'confirm') {
  console.log('click Confirm');
} else if (res === 'cancel') {
  console.log('click Cancel');
}

<!-- 参数为object类型  -->
const res = await this.$messageTips({
  mask: true,
  showClose: false,
  title: '',
  confirmText: '确定',
  cancelText: '取消',
  content: '消息文案',
  showCancel: false,
}).catch(e => e);
// 类型为confrim或者是cancel
if (res === 'confirm') {
  console.log('click Confirm');
} else if (res === 'cancel') {
  console.log('click Cancel');
}

其他命令调用

  1. this.$alert 等同于将showCancel设为false,参数类型和主体一致
  2. this.$comfirm 等同于将showCancel设为true,参数类型和主体一致
1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago