App.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <script>
  2. export default {
  3. globalData: {
  4. //全局数据
  5. domain: "http://www.leixue.com", //域名,便于调用接口
  6. api: "http://www.leixue.com/wp-json/app/v1/",
  7. socketTask: "1",
  8. },
  9. data() {
  10. return {
  11. socketTask: null,
  12. // 确保websocket是打开状态
  13. is_open_socket: false,
  14. timer: 0,
  15. num: 0,
  16. };
  17. },
  18. created() {
  19. console.log("App.vue created");
  20. },
  21. onLaunch: function () {
  22. console.warn(
  23. "当前组件仅支持 uni_modules 目录结构 ,请升级 HBuilderX 到 3.1.0 版本以上!"
  24. );
  25. console.log("App Launch");
  26. },
  27. onShow: function () {
  28. console.log("App Show");
  29. let _this = this;
  30. uni.getStorage({
  31. key: "num",
  32. success(res) {
  33. console.log("获取成功", res.data);
  34. _this.num = res.data;
  35. },
  36. });
  37. },
  38. onHide: function () {
  39. console.log("App Hide");
  40. },
  41. mounted() {
  42. console.log("渲染0");
  43. },
  44. methods: {
  45. //连接websocket
  46. },
  47. };
  48. </script>
  49. <style lang="scss">
  50. @import "uview-ui/index.scss";
  51. @import "color-ui/main.css";
  52. /*每个页面公共css */
  53. @import "@/uni_modules/uni-scss/index.scss";
  54. /* #ifndef APP-NVUE */
  55. @import "@/static/customicons.css";
  56. // 设置整个项目的背景色
  57. page {
  58. background-color: #f5f5f5;
  59. }
  60. .rec {
  61. box-sizing: border-box;
  62. position: relative;
  63. overflow: hidden;
  64. /* margin: 300px auto; */
  65. /* width: 300px; */
  66. /* height: 4px; */
  67. /* border: 0.1px solid #ccc; */
  68. }
  69. .rec::before {
  70. position: absolute;
  71. bottom: 0;
  72. content: "";
  73. height: 2px;
  74. width: 158px;
  75. background-color: red;
  76. /* 依次对应:动画名、时长、匀速、无限循环 */
  77. animation: move 3s;
  78. }
  79. @keyframes move {
  80. from {
  81. left: -100%;
  82. }
  83. to {
  84. left: 100%;
  85. }
  86. }
  87. /* #endif */
  88. .example-info {
  89. font-size: 14px;
  90. color: #333;
  91. padding: 10px;
  92. }
  93. </style>