{"id":27674,"date":"2024-11-24T14:33:09","date_gmt":"2024-11-24T06:33:09","guid":{"rendered":"https:\/\/fwq.ai\/blog\/27674\/"},"modified":"2024-11-24T14:33:09","modified_gmt":"2024-11-24T06:33:09","slug":"%e7%a7%bb%e5%8a%a8%e7%ab%af-h5-%e5%bc%80%e5%8f%91%e4%b8%ad%e5%a6%82%e4%bd%95%e9%81%bf%e5%85%8d%e5%ba%95%e9%83%a8-tab-%e6%a0%8f%e5%88%87%e6%8d%a2%e5%af%bc%e8%87%b4%e9%a1%b5%e9%9d%a2%e5%8d%b8%e8%bd%bd","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/27674\/","title":{"rendered":"\u79fb\u52a8\u7aef H5 \u5f00\u53d1\u4e2d\u5982\u4f55\u907f\u514d\u5e95\u90e8 Tab \u680f\u5207\u6362\u5bfc\u81f4\u9875\u9762\u5378\u8f7d\u548c\u6570\u636e\u91cd\u65b0\u52a0\u8f7d\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173130410383589.jpg\" class=\"aligncenter\" title=\"\u79fb\u52a8\u7aef H5 \u5f00\u53d1\u4e2d\u5982\u4f55\u907f\u514d\u5e95\u90e8 Tab \u680f\u5207\u6362\u5bfc\u81f4\u9875\u9762\u5378\u8f7d\u548c\u6570\u636e\u91cd\u65b0\u52a0\u8f7d\uff1f\u63d2\u56fe\" alt=\"\u79fb\u52a8\u7aef H5 \u5f00\u53d1\u4e2d\u5982\u4f55\u907f\u514d\u5e95\u90e8 Tab \u680f\u5207\u6362\u5bfc\u81f4\u9875\u9762\u5378\u8f7d\u548c\u6570\u636e\u91cd\u65b0\u52a0\u8f7d\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u79fb\u52a8\u7aef h5 \u5f00\u53d1\u4e2d\u5e95\u90e8 tab \u680f\u5207\u6362\u529f\u80fd\u7684\u8bbe\u8ba1<\/strong><\/p>\n<p>\u5728\u79fb\u52a8\u7aef h5 \u5f00\u53d1\u4e2d\uff0c\u5e95\u90e8 tab \u680f\u5207\u6362\u662f\u4e00\u4e2a\u5e38\u89c1\u7684\u9700\u6c42\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u4e00\u79cd\u6709\u6548\u7684\u8bbe\u8ba1\u6a21\u5f0f\uff0c\u89e3\u51b3\u5207\u6362 tab \u65f6\u9875\u9762\u5378\u8f7d\u548c\u6570\u636e\u91cd\u65b0\u52a0\u8f7d\u7684\u95ee\u9898\u3002<\/p>\n<p><strong>\u95ee\u9898\u5206\u6790<\/strong><\/p>\n<p>\u6700\u521d\uff0c\u91c7\u7528\u8def\u7531\u5d4c\u5957\u7684\u8bbe\u8ba1\u65b9\u6cd5\uff0c\u4f7f\u5f97\u6bcf\u4e2a tab \u90fd\u662f\u4e00\u4e2a\u72ec\u7acb\u7684\u8def\u7531\u3002\u4f46\u8fd9\u79cd\u8bbe\u8ba1\u5b58\u5728\u4ee5\u4e0b\u95ee\u9898\uff1a<\/p>\n<ul>\n<li>\u5207\u6362 tab \u65f6\u9875\u9762\u4f1a\u5378\u8f7d\uff0c\u5bfc\u81f4\u6570\u636e\u91cd\u65b0\u52a0\u8f7d\u3002<\/li>\n<li>\u65e0\u6cd5\u4fdd\u7559\u9875\u9762\u6eda\u52a8\u9ad8\u5ea6\u3002<\/li>\n<\/ul>\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n<p>\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e9b\u95ee\u9898\uff0c\u6211\u4eec\u53ef\u4ee5\u91c7\u7528\u4ee5\u4e0b\u8bbe\u8ba1\u6a21\u5f0f\uff1a<\/p>\n<ul>\n<li>\u4f7f\u7528\u7ec4\u4ef6\u5316\u8bbe\u8ba1\uff0c\u5c06 tab \u7ec4\u4ef6\u5316\u3002<\/li>\n<li>\u901a\u8fc7\u63a7\u5236\u7ec4\u4ef6\u7684\u663e\u9690\u5207\u6362 tab\u3002<\/li>\n<\/ul>\n<p>\u5177\u4f53\u5b9e\u73b0\u5982\u4e0b\uff1a<\/p>\n<ol>\n<li>\u5728\u4e00\u4e2a\u9875\u9762\u4e2d\u5f15\u5165 tab \u7ec4\u4ef6\uff0c\u5206\u522b\u8d1f\u8d23 tab \u5bfc\u822a\u548c\u5185\u5bb9\u663e\u793a\u3002<\/li>\n<li>\u6839\u636e\u5f53\u524d\u8def\u7531\u72b6\u6001\uff0c\u63a7\u5236 tab \u7ec4\u4ef6\u7684\u663e\u9690\u3002<\/li>\n<li>\u4f7f\u7528 -router \u7684 keep-alive \u7ec4\u4ef6\u4fdd\u5b58\u5728 tab \u4e2d\u6e32\u67d3\u7684\u5185\u5bb9\u3002<\/li>\n<\/ol>\n<p>\u8fd9\u6837\uff0c\u5207\u6362 tab \u65f6\u53ea\u9700\u8981\u63a7\u5236 tab \u7ec4\u4ef6\u7684\u663e\u9690\u5373\u53ef\uff0c\u65e0\u9700\u91cd\u65b0\u52a0\u8f7d\u9875\u9762\u6216\u91cd\u65b0\u83b7\u53d6\u6570\u636e\uff0c\u9875\u9762\u6eda\u52a8\u9ad8\u5ea6\u4e5f\u80fd\u5f97\u5230\u4fdd\u7559\u3002<\/p>\n<p><strong>\u793a\u4f8b\u4ee3\u7801<\/strong><\/p>\n<pre>&lt;template&gt;\n  &lt;div&gt;\n    &lt;tab-nav :active-tab=\"activeTab\" @tab-change=\"onTabChange\" \/&gt;\n    &lt;keep-alive&gt;\n      &lt;router-view \/&gt;\n    &lt;\/keep-alive&gt;\n  &lt;\/div&gt;\n&lt;\/template&gt;\n\n&lt;script&gt;\nimport TabNav from 'path\/to\/TabNav.vue'\n\nexport default {\n  components: { TabNav },\n  data() {\n    return {\n      activeTab: 'tab1'\n    }\n  },\n  methods: {\n    onTabChange(activeTab) {\n      this.activeTab = activeTab\n    }\n  }\n}\n&lt;\/script&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u79fb\u52a8\u7aef H5 \u5f00\u53d1\u4e2d\u5982\u4f55\u907f\u514d\u5e95\u90e8 Tab \u680f\u5207\u6362\u5bfc\u81f4\u9875\u9762\u5378\u8f7d\u548c\u6570\u636e\u91cd\u65b0\u52a0\u8f7d\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u79fb\u52a8\u7aef h5 \u5f00\u53d1\u4e2d\u5e95\u90e8 tab \u680f\u5207\u6362\u529f\u80fd\u7684\u8bbe\u8ba1 \u5728\u79fb\u52a8\u7aef h5 \u5f00\u53d1\u4e2d\uff0c\u5e95\u90e8 tab \u680f\u5207\u6362\u662f\u4e00\u4e2a\u5e38\u89c1\u7684\u9700\u6c42\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u4e00\u79cd\u6709\u6548\u7684\u8bbe\u8ba1\u6a21\u5f0f\uff0c\u89e3\u51b3\u5207\u6362 tab \u65f6\u9875\u9762\u5378\u8f7d\u548c\u6570\u636e\u91cd\u65b0\u52a0\u8f7d\u7684\u95ee\u9898\u3002 \u95ee\u9898\u5206\u6790 \u6700\u521d\uff0c\u91c7\u7528\u8def\u7531\u5d4c\u5957\u7684\u8bbe\u8ba1\u65b9\u6cd5\uff0c\u4f7f\u5f97\u6bcf\u4e2a tab \u90fd\u662f\u4e00\u4e2a\u72ec\u7acb\u7684\u8def\u7531\u3002\u4f46\u8fd9\u79cd\u8bbe\u8ba1\u5b58\u5728\u4ee5\u4e0b\u95ee\u9898\uff1a \u5207\u6362 tab \u65f6\u9875\u9762\u4f1a\u5378\u8f7d\uff0c\u5bfc\u81f4\u6570\u636e\u91cd\u65b0\u52a0\u8f7d\u3002 \u65e0\u6cd5\u4fdd\u7559\u9875\u9762\u6eda\u52a8\u9ad8\u5ea6\u3002 \u89e3\u51b3\u65b9\u6848 \u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e9b\u95ee\u9898\uff0c\u6211\u4eec\u53ef\u4ee5\u91c7\u7528\u4ee5\u4e0b\u8bbe\u8ba1\u6a21\u5f0f\uff1a \u4f7f\u7528\u7ec4\u4ef6\u5316\u8bbe\u8ba1\uff0c\u5c06 tab \u7ec4\u4ef6\u5316\u3002 \u901a\u8fc7\u63a7\u5236\u7ec4\u4ef6\u7684\u663e\u9690\u5207\u6362 tab\u3002 \u5177\u4f53\u5b9e\u73b0\u5982\u4e0b\uff1a \u5728\u4e00\u4e2a\u9875\u9762\u4e2d\u5f15\u5165 tab \u7ec4\u4ef6\uff0c\u5206\u522b\u8d1f\u8d23 tab \u5bfc\u822a\u548c\u5185\u5bb9\u663e\u793a\u3002 \u6839\u636e\u5f53\u524d\u8def\u7531\u72b6\u6001\uff0c\u63a7\u5236 tab \u7ec4\u4ef6\u7684\u663e\u9690\u3002 \u4f7f\u7528 -router \u7684 keep-alive \u7ec4\u4ef6\u4fdd\u5b58\u5728 tab \u4e2d\u6e32\u67d3\u7684\u5185\u5bb9\u3002 \u8fd9\u6837\uff0c\u5207\u6362 tab \u65f6\u53ea\u9700\u8981\u63a7\u5236 tab \u7ec4\u4ef6\u7684\u663e\u9690\u5373\u53ef\uff0c\u65e0\u9700\u91cd\u65b0\u52a0\u8f7d\u9875\u9762\u6216\u91cd\u65b0\u83b7\u53d6\u6570\u636e\uff0c\u9875\u9762\u6eda\u52a8\u9ad8\u5ea6\u4e5f\u80fd\u5f97\u5230\u4fdd\u7559\u3002 \u793a\u4f8b\u4ee3\u7801 &lt;template&gt; &lt;div&gt; &lt;tab-nav :active-tab=&#8221;activeTab&#8221; @tab-change=&#8221;onTabChange&#8221; \/&gt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-27674","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27674","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=27674"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27674\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=27674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=27674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=27674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}