alert.js 746 B

12345678910111213141516171819202122232425262728293031323334
  1. const util = require("../../utils/util.js");
  2. Component({
  3. properties: {
  4. show:{
  5. type: Boolean,
  6. observer: function(newVal, oldVal) {
  7. this.setData({ show: newVal })
  8. }
  9. },
  10. _CONFIG_: {
  11. type: Object,
  12. observer: function(newVal, oldVal) {
  13. if (!util.isObjEmpty(newVal) && typeof (newVal.score) != 'undefined') newVal.score = newVal.score.toString();
  14. this.setData({ _CONFIG_: newVal });
  15. }
  16. }
  17. },
  18. data: {
  19. config: util.config,
  20. _CONFIG_: {
  21. title: '',
  22. content: '',
  23. status: 0,
  24. score: '',
  25. icon: 'read-ok'
  26. }
  27. },
  28. methods: {
  29. close(){
  30. this.setData({show:false});
  31. this.triggerEvent("close", { show: this.data.show})
  32. }
  33. }
  34. })