uni_android_plugin_project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
2.1 KiB

  1. <template>
  2. <view class="button-sp-area">
  3. <button type="primary" plain="true" @click="showRichAlert()">点击显示弹窗</button>
  4. </view>
  5. </template>
  6. <script>
  7. const modal = uni.requireNativePlugin('modal');
  8. const dcRichAlert = uni.requireNativePlugin('DCloud-RichAlert');
  9. export default {
  10. data() {
  11. return {
  12. title: ''
  13. }
  14. },
  15. onLoad() {
  16. },
  17. methods: {
  18. showRichAlert() {
  19. dcRichAlert.show({
  20. position: 'bottom',
  21. title: "提示信息",
  22. titleColor: '#FF0000',
  23. content: "<a href='https://uniapp.dcloud.io/' value='Hello uni-app'>uni-app</a> 是一个使用 Vue.js 开发跨平台应用的前端框架!\n免费的\n免费的\n免费的\n重要的事情说三遍",
  24. contentAlign: 'left',
  25. checkBox: {
  26. title: '不再提示',
  27. isSelected: true
  28. },
  29. buttons: [{
  30. title: '取消'
  31. },
  32. {
  33. title: '否'
  34. },
  35. {
  36. title: '确认',
  37. titleColor: '#3F51B5'
  38. }
  39. ]
  40. }, result => {
  41. const msg = JSON.stringify(result);
  42. modal.toast({
  43. message: msg,
  44. duration: 1.5
  45. });
  46. switch (result.type) {
  47. case 'button':
  48. console.log("callback---button--" + result.index);
  49. break;
  50. case 'checkBox':
  51. console.log("callback---checkBox--" + result.isSelected);
  52. break;
  53. case 'a':
  54. console.log("callback---a--" + JSON.stringify(result));
  55. break;
  56. case 'backCancel':
  57. console.log("callback---backCancel--");
  58. break;
  59. }
  60. });
  61. },
  62. // nvueclick() {
  63. // uni.navigateTo({
  64. // url: '/pages/nvue/index2'
  65. // });
  66. // }
  67. }
  68. }
  69. </script>
  70. <style>
  71. button {
  72. margin-top: 30upx;
  73. margin-bottom: 30upx;
  74. }
  75. .button-sp-area {
  76. margin: 0 auto;
  77. width: 60%;
  78. }
  79. .content {
  80. text-align: center;
  81. height: 400upx;
  82. }
  83. .wrapper {
  84. flex-direction: column;
  85. justify-content: center;
  86. }
  87. .button {
  88. width: 200px;
  89. margin-top: 30px;
  90. margin-left: 20px;
  91. padding-top: 20px;
  92. padding-bottom: 20px;
  93. border-width: 2px;
  94. border-style: solid;
  95. border-color: #458B00;
  96. background-color: #458B00;
  97. }
  98. .text {
  99. font-size: 30px;
  100. color: #666666;
  101. text-align: center;
  102. }
  103. </style>