{"id":54,"date":"2024-02-02T19:38:14","date_gmt":"2024-02-02T11:38:14","guid":{"rendered":"https:\/\/ishht.com\/?p=54"},"modified":"2024-02-02T19:41:41","modified_gmt":"2024-02-02T11:41:41","slug":"%e6%97%a5%e5%b8%b8%e8%ae%b0%e5%bd%95%ef%bc%88%e7%9f%a5%e8%af%86%ef%bc%89","status":"publish","type":"post","link":"https:\/\/ishht.com\/?p=54","title":{"rendered":"\u65e5\u5e38\u8bb0\u5f55\uff08\u77e5\u8bc6\uff09"},"content":{"rendered":"<h2>\u4e00\u3001h5\u8df3\u8f6capp\u4e0a\u7684\u67d0\u4e00\u4e2a\u9875\u9762<\/h2>\n<pre class=\"corepress-code-pre\"><code>\u4e00\u3001window.location.href\u540e\u9762\u7684\u4e3a\u8df3\u8f6c\u65f6\u7684\u8def\u7531\r\n1.\u8df3\u8f6c\u5230\u623f\u95f4 \/\/item.id\u4e3a\u623f\u95f4\u7684id\r\nwindow.location.href = 'enen:\/\/apppage\/chatroom\/entry?enterType=1&amp;chatRoomId=' + item.id;\r\n2.\u8df3\u8f6c\u5230\u4e2a\u4eba\u4e3b\u9875 \/\/item.id\u4e3a\u7528\u6237\u7684\u7684id\r\nwindow.location.href = 'enen:\/\/apppage\/user\/homepage?userId=' + item.id; <\/code><\/pre>\n<h2>\u4e8c\u3001\u5224\u65ad\u5f53\u524d\u662f\u79fb\u52a8\u7aef\u8fd8\u662fPC\u7aef<\/h2>\n<pre class=\"corepress-code-pre\"><code>1.if (\/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini\/i.test(navigator.userAgent)) {\r\n        \/\/ \u79fb\u52a8\u7aef\r\n      } else {\r\n        \/\/PC\u7aef\r\n      }\r\n    \r\n2.const isMobile = 'ontouchstart' in window; \/\/ \u5224\u65ad\u662f\u5426\u652f\u6301\u89e6\u6478\u4e8b\u4ef6\r\n \r\n \r\n3.\u5224\u65ad\u662fAndroid\u8fd8\u662fios\r\n \r\n   \/\/ const u = navigator.userAgent;\r\n    \/\/ const isAndroid = u.indexOf('Android') &gt; -1 || u.indexOf('Adr') &gt; -1; \/\/ \u5224\u65ad\u662f\u5426\u662f\u5b89\u5353\r\n    \/\/ const isIOS = !!u.match(\/\\(i[^;]+;( U;)? CPU.+Mac OS X\/); \/\/ \u5224\u65ad\u662f\u5426\u662fiOS\r\n    \/\/ console.log(isAndroid, 'android');\r\n    \/\/ console.log(isIOS, 'ios');<\/code><\/pre>\n<h2>\u4e09\u3001el-date-picker\u53ea\u80fd\u9009\u62e930\u5929<\/h2>\n<p>\u9700\u6c42\uff1a\u63a7\u5236\u65e5\u671f\u6700\u591a\u53ea\u80fd\u9009\u62e930\u5929\uff0c\u6240\u4ee5\u5f53\u6211\u9009\u62e9\u5176\u4e2d\u4e00\u4e2a\u65e5\u671f\u540e\uff0c\u7b2c\u4e8c\u4e2a\u65e5\u671f\u9009\u62e9\u53ea\u80fd\u63a7\u5236\u5728\u524d\u540e30\u5929\uff08\u610f\u601d\u5c31\u662f\u53ea\u6709\u5728\u9009\u62e9\u4e86\u4e00\u4e2a\u65e5\u671f\u4ee5\u540e\uff0c\u6211\u4eec\u624d\u80fd\u786e\u5b9a\u5269\u4e0b\u4e00\u4e2a\u65e5\u671f\u7684\u9009\u62e9\u8303\u56f4\uff09<\/p>\n<p>\u9996\u5148\u9700\u8981\u5b89\u88c5<a href=\"https:\/\/so.csdn.net\/so\/search?q=dayjs&amp;spm=1001.2101.3001.7020\" target=\"_blank\" class=\"hl hl-1\" data-report-click=\"{&quot;spm&quot;:&quot;1001.2101.3001.7020&quot;,&quot;dest&quot;:&quot;https:\/\/so.csdn.net\/so\/search?q=dayjs&amp;spm=1001.2101.3001.7020&quot;,&quot;extra&quot;:&quot;{\\&quot;searchword\\&quot;:\\&quot;dayjs\\&quot;}&quot;}\" data-tit=\"dayjs\" data-pretit=\"dayjs\" rel=\"noopener\">dayjs<\/a><br \/>\n<strong>\u4e00\uff0c\u5b89\u88c5<\/strong><br \/>\n1.\u4f7f\u7528<a href=\"https:\/\/so.csdn.net\/so\/search?q=npm%E5%AE%89%E8%A3%85&amp;spm=1001.2101.3001.7020\" target=\"_blank\" class=\"hl hl-1\" data-report-click=\"{&quot;spm&quot;:&quot;1001.2101.3001.7020&quot;,&quot;dest&quot;:&quot;https:\/\/so.csdn.net\/so\/search?q=npm%E5%AE%89%E8%A3%85&amp;spm=1001.2101.3001.7020&quot;,&quot;extra&quot;:&quot;{\\&quot;searchword\\&quot;:\\&quot;npm\u5b89\u88c5\\&quot;}&quot;}\" data-tit=\"npm\u5b89\u88c5\" data-pretit=\"npm\u5b89\u88c5\" rel=\"noopener\">npm\u5b89\u88c5<\/a><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"corepress-code-pre\"><code>npm install dayjs\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"corepress-code-pre\"><code>&lt;el-date-picker @blur=\"datePickerBlur\" @change=\"datePickerChange\" v-model=\"time\" type=\"daterange\"\r\n                range-separator=\"\u81f3\" start-placeholder=\"\u5f00\u59cb\u65e5\u671f\" end-placeholder=\"\u7ed3\u675f\u65e5\u671f\" :picker-options=\"pickerOptions\"&gt;\r\n&lt;\/el-date-picker&gt;\r\n \r\n&lt;script&gt;\r\n\/\/ \u5f15\u5165Day.js\r\nimport dayjs from 'dayjs'\r\n\/\/ \u524d\u540e\u9700\u8981\u7684\u5929\u6570-1\r\nconst space = 29\r\n\/\/ \u6240\u9009\u7684\u7b2c\u4e00\u4e2a\u65e5\u671f\r\nlet _minDate = ''\r\nexport default {\r\n    \/\/ name: 'home',\r\n    data() {\r\n        return {\r\n            \/\/ \u9009\u4e2d\u65f6\u95f4\u6bb5(\u9ed8\u8ba4\u662f\u8fd1\u4e00\u5468)\r\n            time: '',\r\n            pickerOptions: {\r\n                \/\/ \u8bbe\u7f6e\u7981\u7528\u72b6\u6001\r\n                disabledDate: (time) =&gt; {\r\n                    \/\/ \u5f53\u9009\u4e2d\u7b2c\u4e00\u4e2a\u65f6\u95f4\u65f6\r\n                    if (_minDate) {\r\n                        \/\/ \u6700\u5c0f\u65f6\u95f4\r\n                        const min = dayjs(_minDate).subtract(space, 'day')\r\n                        \/\/ \u6700\u5927\u65f6\u95f4\r\n                        const max = dayjs(_minDate).add(space, 'day')\r\n                        return (\r\n                            \/\/ \u63a7\u5236\u53ef\u4ee5\u9009\u62e9\u7684\u65f6\u95f4\u8303\u56f4\r\n                            dayjs(time).isBefore(min) ||\r\n                            dayjs(max).isBefore(time)\r\n                        )\r\n                    } else {\r\n                        return false\r\n                    }\r\n                },\r\n                \/\/ \u9009\u4e2d\u65e5\u671f\u540e\u4f1a\u6267\u884c\u7684\u56de\u8c03\r\n                onPick({ minDate }) {\r\n                    _minDate = minDate\r\n                },\r\n            },\r\n        }\r\n    },\r\n    methods: {\r\n        \/\/ \u65f6\u95f4 \u53d1\u751f\u6539\u53d8\u65f6\r\n        datePickerChange() {\r\n            \/\/ \u5224\u65ad\u65f6\u95f4\u6bb5\u4e3anull\u65f6 \u81f3\u7a7a\u6240\u9009\u7684\u7b2c\u4e00\u4e2a\u65e5\u671f(\u76ee\u7684\u662f\u907f\u514d\u7c7b\u578b\u9519\u8bef\u7684\u62a5\u9519)\r\n            if (!this.time) {\r\n                _minDate = ''\r\n                return\r\n            }\r\n        },\r\n        \/\/ \u65f6\u95f4 \u5931\u53bb\u7126\u70b9\u65f6\r\n        datePickerBlur() {\r\n            \/\/ \u5224\u65ad\u65f6\u95f4\u6bb5\u4e0d\u4e3anull\u5e76\u4e14\u6570\u7ec4\u957f\u5ea6\u4e3a0\u65f6 \u81f3\u7a7a\u6240\u9009\u7684\u7b2c\u4e00\u4e2a\u65e5\u671f(\u76ee\u7684\u662f\u907f\u514d\u7c7b\u578b\u9519\u8bef\u7684\u62a5\u9519)\r\n            if (this.time &amp;&amp; this.time.length === 0) {\r\n                _minDate = ''\r\n            }\r\n        },\r\n    },\r\n}\r\n \r\n&lt;\/script&gt;<\/code><\/pre>\n<p>&nbsp;<\/p>\n<h2>\u56db\u3001\u6839\u636e\u5e74\u4efd\u548c\u6708\u4efd\u83b7\u53d6\u5f53\u524d\u8fd9\u4e2a\u6708\u7684\u7b2c\u4e00\u5929\u548c\u6700\u540e\u4e00\u5929<\/h2>\n<pre class=\"corepress-code-pre\"><code>\/\/\u5f15\u5165\r\nimport moment from \"moment\"; \u4e8c\u79cd\u5f15\u5165\u65b9\u5f0f\r\nconst moment = require('moment'); \r\n \r\nconst givenYear = 2023; \/\/\u5e74\u4efd\r\nconst givenMonth = 5 \/\/\u8fd9\u4e2a\u662f\u5f53\u524d\u7684\u6708\u4efd\r\nconst firstDayOfMonth = moment(`${currentYear}-${givenMonth.toString().padStart(2, '0')}-01`).startOf('day').format('YYYY-MM-DD'); \/\/\u5f53\u524d\u6708\u7b2c\u4e00\u5929\r\nconst lastDayOfMonth = moment(firstDayOfMonth).endOf('month').format('YYYY-MM-DD'); \/\/\u5f53\u524d\u6708\u7b2c\u4e8c\u5929<\/code><\/pre>\n<h2>\u4e94\u3001\u901a\u8fc7\u65f6\u95f4\u6233\u83b7\u53d6\u5929\u65f6\u5206\u79d2<\/h2>\n<pre class=\"corepress-code-pre\"><code>let d = parseInt(t \/ 60 \/ 60 \/ 24)\r\n      let h = parseInt(t \/ 60 \/ 60 % 24)\r\n      let m = parseInt(t \/ 60 % 60)\r\n      let s = parseInt(t % 60)\r\n      \/\/ \u56e0\u4e3ah\u5df2\u7ecf\u662f\u6570\u5b57\u578b\u4e86\uff0c\u5982\u679c0\u4e0d\u52a0\u5f15\u53f7\u5c31\u53d8\u6210\u52a0\u6cd5\u4e86\r\n      h = h &lt; 10 ? '0' + h : h\r\n      m = m &lt; 10 ? '0' + m : m\r\n      s = s &lt; 10 ? '0' + s : s\r\n      return `${d}\u5929${h}\u5c0f\u65f6${m}\u5206${s}\u79d2`<\/code><\/pre>\n<h2>\u516d\u3001vuetify\u7684\u5bfc\u822a\u680f<\/h2>\n<p><a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/blog.csdn.net\/gaogzhen\/article\/details\/103872481?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522169940966616777224425097%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&amp;request_id=169940966616777224425097&amp;biz_id=0&amp;utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-2-103872481-null-null.142%5Ev96%5Epc_search_result_base1&amp;utm_term=v-navigation-drawer&amp;spm=1018.2226.3001.4187\" title=\"vuetify\u5b66\u4e60\u7b2c\u56db\u5929-\u5178\u578b\u5bfc\u822a\u83dc\u5355\u5b9e\u73b0_vuetify mega \u83dc\u5355-CSDN\u535a\u5ba2\">vuetify\u5b66\u4e60\u7b2c\u56db\u5929-\u5178\u578b\u5bfc\u822a\u83dc\u5355\u5b9e\u73b0_vuetify mega \u83dc\u5355-CSDN\u535a\u5ba2<\/a><\/p>\n<h2>\u4e03\u3001\u6253\u5305\u8fc7\u540e\u5185\u5bb9\u4e0d\u663e\u793a\uff0c\u81ea\u5df1\u542f\u52a8\u65f6\u53ef\u4ee5\u7684\u95ee\u9898\u89e3\u51b3<\/h2>\n<p><span>1.\u5728vite.config.js\u91cc\u9762\u52a0\u5165<\/span><\/p>\n<pre class=\"corepress-code-pre\"><code>import { fileURLToPath, URL } from 'node:url'\r\n \r\nimport { defineConfig } from 'vite'\r\nimport vue from '@vitejs\/plugin-vue'\r\n \r\n\/\/ https:\/\/vitejs.dev\/config\/\r\nexport default defineConfig({\r\n  base: \".\/\", \/\/\u52a0\u5165\u8fd9\u4e2a\r\n  plugins: [\r\n    vue(),\r\n  ],\r\n  resolve: {\r\n    alias: {\r\n      '@': fileURLToPath(new URL('.\/src', import.meta.url))\r\n    }\r\n  }\r\n})<\/code><\/pre>\n<p><span>2.\u5728router\u91cc\u9762\u7684index\u91cc\u9762\u52a0\u5165<\/span><\/p>\n<pre class=\"corepress-code-pre\"><code>import { createRouter, createWebHashHistory } from 'vue-router'\r\n \r\nconst router = createRouter({\r\n    history:createWebHashHistory(), \/\/\u52a0\u4e0a\u8fd9\u4e2a\r\n      routes: [\r\n      {\r\n        path: '\/',\r\n        name: 'home',\r\n        component:() =&gt; import('..\/pages\/MainPage.vue'),\r\n      },\r\n      {\r\n        path: '\/about',\r\n        name: 'about',\r\n        component: () =&gt; import('..\/pages\/Pagination.vue')\r\n      },\r\n      {\r\n        path: '\/DownloadCenter',\r\n        name: 'DownloadCenter',\r\n        component: () =&gt; import('..\/pages\/DownloadCenter.vue')\r\n      },\r\n    ]\r\n  })\r\n  \r\n  export default router<\/code><\/pre>\n<h2>\u516b\u3001h5\u8df3\u8f6c\u9875\u9762\u83b7\u53d6app\u7684token\u7b49\u4fe1\u606f<\/h2>\n<pre class=\"corepress-code-pre\"><code>    let agents = navigator.userAgent.substr(navigator.userAgent.indexOf(\"vchat\") + 6);\r\n    let enenAgent = agents.length &gt; 0 ? agents.split(\" \")[0] : \"\";\r\n    let enenArgs = enenAgent.split(\"\/\");\r\n    let roomInformation = enenArgs.length &gt; 4 ? enenArgs[4] : '';\r\n   \/\/ enenArgs[0] token\r\n   \/\/ enenArgs[1] \u7248\u672c\u53f7\r\n   \/\/ enenArgs[2] \u5bfc\u822a\u680f\u9ad8\u5ea6\r\n   \/\/ enenArgs[3] \u7528\u6237\u4fe1\u606f\r\n   \/\/ enenArgs[4] \u623f\u95f4\u4e3b\u6301\u4ebaID\u548c\u623f\u95f4ID<\/code><\/pre>\n<h2>\u4e5d\u3001img\u7ed9\u56fa\u5b9a\u5bbd\u5ea6\u548c\u9ad8\u5ea6\u56fe\u6807\u53d8\u5f62\u95ee\u9898<\/h2>\n<pre class=\"corepress-code-pre\"><code> object-fit: cover;\r\n<\/code><\/pre>\n<h2><\/h2>\n<p>fill\uff1a\u9ed8\u8ba4\u503c\u3002\u5143\u7d20\u4f1a\u88ab\u62c9\u4f38\u4ee5\u586b\u5145\u5bb9\u5668\uff0c\u4e0d\u4fdd\u6301\u539f\u59cb\u6bd4\u4f8b\uff0c\u53ef\u80fd\u5bfc\u81f4\u56fe\u50cf\u53d8\u5f62\u3002<\/p>\n<p>contain\uff1a\u5143\u7d20\u4f1a\u6309\u7167\u5176\u539f\u59cb\u6bd4\u4f8b\u7f29\u653e\uff0c\u5c3d\u91cf\u5b8c\u6574\u5730\u663e\u793a\u5728\u5bb9\u5668\u5185\uff0c\u4f46\u5bb9\u5668\u53ef\u80fd\u672a\u88ab\u5b8c\u5168\u586b\u6ee1\u3002\u4fdd\u6301\u56fe\u50cf\u6bd4\u4f8b\u4e0d\u53d8\u3002<\/p>\n<p>cover\uff1a\u5143\u7d20\u4f1a\u6309\u7167\u5176\u539f\u59cb\u6bd4\u4f8b\u7f29\u653e\uff0c\u5e76\u5c3d\u91cf\u94fa\u6ee1\u5bb9\u5668\uff0c\u53ef\u80fd\u4f1a\u526a\u88c1\u6389\u4e00\u90e8\u5206\u5185\u5bb9\u3002\u4fdd\u6301\u56fe\u50cf\u6bd4\u4f8b\u4e0d\u53d8\u3002<\/p>\n<p>none\uff1a\u5143\u7d20\u5c06\u6309\u7167\u5176\u539f\u59cb\u5c3a\u5bf8\u8fdb\u884c\u663e\u793a\uff0c\u53ef\u80fd\u4f1a\u8d85\u51fa\u5bb9\u5668\u3002\u4e0d\u8fdb\u884c\u4efb\u4f55\u7f29\u653e\u6216\u88c1\u526a\u3002<\/p>\n<p>scale-down\uff1a\u5143\u7d20\u4f1a\u6839\u636e\u5176\u539f\u59cb\u5c3a\u5bf8\u548c\u5bb9\u5668\u5c3a\u5bf8\u8fdb\u884c\u7f29\u653e\uff0c\u9009\u62e9\u8f83\u5c0f\u7684\u7f29\u653e\u6bd4\u4f8b<br \/>\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014<\/p>\n<p><span>\u5341\u3001vuetify\u4e2dv-main\u62a5\u9519<\/span><\/p>\n<p>[Vue warn]: Unknown custom element: &lt;v-main&gt; &#8211; did you register the component correctly? For recursive components, make sure to provide the &#8220;name&#8221; option.<\/p>\n<p>\u89e3\u51b3\u65b9\u6848\uff1a\u628av-main\u6362\u6210v-content<br \/>\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014<\/p>\n<p>\u7248\u6743\u58f0\u660e\uff1a\u672c\u6587\u4e3a\u535a\u4e3b\u539f\u521b\u6587\u7ae0\uff0c\u9075\u5faa CC 4.0 BY-SA \u7248\u6743\u534f\u8bae\uff0c\u8f6c\u8f7d\u8bf7\u9644\u4e0a\u539f\u6587\u51fa\u5904\u94fe\u63a5\u548c\u672c\u58f0\u660e\u3002<\/p>\n<p>\u539f\u6587\u94fe\u63a5\uff1ahttps:\/\/blog.csdn.net\/lipenghao111\/article\/details\/132901064<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001h5\u8df3\u8f6capp\u4e0a\u7684\u67d0\u4e00\u4e2a\u9875\u9762 \u4e00\u3001window.location.href\u540e\u9762\u7684\u4e3a\u8df3\u8f6c\u65f6\u7684\u8def\u7531 1.\u8df3\u8f6c\u5230\u623f\u95f4 \/\/item.id\u4e3a\u623f\u95f4\u7684id window.location.href = &#8216;enen:\/\/apppage\/chatroom\/entry?enterType=1&amp;chatRoomId=&#8217; + item.id; 2.\u8df3\u8f6c\u5230\u4e2a\u4eba\u4e3b\u9875 \/\/item.id\u4e3a\u7528\u6237\u7684\u7684id window.location.href = &#8216;enen:\/\/apppage\/user\/homepage?userId=&#8217; + item.id; \u4e8c\u3001\u5224\u65ad\u5f53\u524d\u662f\u79fb\u52a8\u7aef\u8fd8\u662fPC\u7aef 1.if (\/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini\/i.test(navigator.userAgent)) { \/\/ \u79fb\u52a8\u7aef } else { \/\/PC\u7aef } 2.const isMobile = &#8216;ontouchstart&#8217; in window; \/\/ \u5224\u65ad\u662f\u5426\u652f\u6301\u89e6\u6478\u4e8b\u4ef6 3.\u5224\u65ad\u662fAndroid\u8fd8\u662fios \/\/ const u = navigator.userAgent; \/\/ const isAndroid = u.indexOf(&#8216;Android&#8217;) &gt; -1 || u.indexOf(&#8216;Adr&#8217;) &gt; -1; \/\/ \u5224\u65ad\u662f\u5426\u662f\u5b89\u5353 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-54","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/ishht.com\/index.php?rest_route=\/wp\/v2\/posts\/54","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ishht.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ishht.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ishht.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ishht.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=54"}],"version-history":[{"count":0,"href":"https:\/\/ishht.com\/index.php?rest_route=\/wp\/v2\/posts\/54\/revisions"}],"wp:attachment":[{"href":"https:\/\/ishht.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=54"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ishht.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=54"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ishht.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=54"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}