12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <script>
- export default {
- globalData: {
- //全局数据
- domain: "http://www.leixue.com", //域名,便于调用接口
- api: "http://www.leixue.com/wp-json/app/v1/",
- socketTask: "1",
- },
- data() {
- return {
- socketTask: null,
- // 确保websocket是打开状态
- is_open_socket: false,
- timer: 0,
- num: 0,
- };
- },
- created() {
- console.log("App.vue created");
- },
- onLaunch: function () {
- console.warn(
- "当前组件仅支持 uni_modules 目录结构 ,请升级 HBuilderX 到 3.1.0 版本以上!"
- );
- console.log("App Launch");
- },
- onShow: function () {
- console.log("App Show");
- let _this = this;
- uni.getStorage({
- key: "num",
- success(res) {
- console.log("获取成功", res.data);
- _this.num = res.data;
- },
- });
- },
- onHide: function () {
- console.log("App Hide");
- },
- mounted() {
- console.log("渲染0");
- },
- methods: {
- //连接websocket
- },
- };
- </script>
- <style lang="scss">
- @import "uview-ui/index.scss";
- @import "color-ui/main.css";
- /*每个页面公共css */
- @import "@/uni_modules/uni-scss/index.scss";
- /* #ifndef APP-NVUE */
- @import "@/static/customicons.css";
- // 设置整个项目的背景色
- page {
- background-color: #f5f5f5;
- }
- .rec {
- box-sizing: border-box;
- position: relative;
- overflow: hidden;
- /* margin: 300px auto; */
- /* width: 300px; */
- /* height: 4px; */
- /* border: 0.1px solid #ccc; */
- }
- .rec::before {
- position: absolute;
- bottom: 0;
- content: "";
- height: 2px;
- width: 158px;
- background-color: red;
- /* 依次对应:动画名、时长、匀速、无限循环 */
- animation: move 3s;
- }
- @keyframes move {
- from {
- left: -100%;
- }
- to {
- left: 100%;
- }
- }
- /* #endif */
- .example-info {
- font-size: 14px;
- color: #333;
- padding: 10px;
- }
- </style>
|