Index.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <template>
  2. <div id="app-base-powermonitor">
  3. <div class="one-block-1">
  4. <span>
  5. 1. 监控电源状态
  6. </span>
  7. </div>
  8. <div class="one-block-2">
  9. <a-space>
  10. <p>* 当前状态:{{ currentStatus }}</p>
  11. </a-space>
  12. <p>* 拔掉电源,使用电池供电</p>
  13. <p>* 接入电源</p>
  14. <p>* 锁屏</p>
  15. <p>* 解锁</p>
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. import { ipcApiRoute } from '@/api/main'
  21. export default {
  22. data() {
  23. return {
  24. currentStatus: '无',
  25. };
  26. },
  27. mounted () {
  28. this.init();
  29. },
  30. methods: {
  31. init () {
  32. this.$ipc.removeAllListeners(ipcApiRoute.initPowerMonitor);
  33. this.$ipc.on(ipcApiRoute.initPowerMonitor, (event, result) => {
  34. if (Object.prototype.toString.call(result) == '[object Object]') {
  35. this.currentStatus = result.msg;
  36. this.$message.info(result.msg);
  37. }
  38. })
  39. this.$ipc.send(ipcApiRoute.initPowerMonitor, '');
  40. }
  41. }
  42. };
  43. </script>
  44. <style lang="less" scoped>
  45. #app-base-powermonitor {
  46. padding: 0px 10px;
  47. text-align: left;
  48. width: 100%;
  49. .one-block-1 {
  50. font-size: 16px;
  51. padding-top: 10px;
  52. }
  53. .one-block-2 {
  54. padding-top: 10px;
  55. }
  56. }
  57. </style>