{"id":591,"date":"2025-12-07T10:09:38","date_gmt":"2025-12-07T02:09:38","guid":{"rendered":"https:\/\/www.52runoob.com\/?p=591"},"modified":"2025-12-07T10:09:38","modified_gmt":"2025-12-07T02:09:38","slug":"%e4%bd%bf%e7%94%a8vue3%e5%bc%80%e5%8f%91%e9%b8%bf%e8%92%99%e7%9a%84helloworld%e9%99%84%e8%af%a6%e7%bb%86%e5%ae%9e%e7%8e%b0%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"https:\/\/www.52runoob.com\/index.php\/2025\/12\/07\/%e4%bd%bf%e7%94%a8vue3%e5%bc%80%e5%8f%91%e9%b8%bf%e8%92%99%e7%9a%84helloworld%e9%99%84%e8%af%a6%e7%bb%86%e5%ae%9e%e7%8e%b0%e4%bb%a3%e7%a0%81\/","title":{"rendered":"\u4f7f\u7528Vue3\u5f00\u53d1\u9e3f\u8499\u7684HelloWorld(\u9644\u8be6\u7ec6\u5b9e\u73b0\u4ee3\u7801)"},"content":{"rendered":"\n<p>\u4e0b\u9762\u7ed9\u4f60\u4e00\u7bc7 <strong>\u300a\u4f7f\u7528 Vue3 \u5f00\u53d1\u9e3f\u8499 HarmonyOS NEXT \u7684 HelloWorld\uff08\u542b\u5b8c\u6574\u4ee3\u7801 + \u5de5\u7a0b\u7ed3\u6784 + \u6b65\u9aa4\uff09\u300b<\/strong><br>\u9002\u7528\u4e8e <strong>ArkTS + Vue3\uff08Cross-UI \u6846\u67b6\uff09<\/strong> \u7684\u65b9\u5f0f\uff0c\u4e5f\u662f\u5f53\u524d\u6700\u4e3b\u6d41\u3001\u6700\u63a8\u8350\u7684\u5199\u6cd5\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\ud83d\ude80 1. HarmonyOS Vue3 \u5f00\u53d1\u65b9\u5f0f\u8bf4\u660e<\/h1>\n\n\n\n<p>\u9e3f\u8499\u4e0d\u662f\u76f4\u63a5\u8fd0\u884c\u4f20\u7edf Web Vue3\uff0c\u800c\u662f\u901a\u8fc7 <strong>ArkUI Cross-UI + Vue DSL<\/strong> \u7684\u65b9\u5f0f\u652f\u6301 Vue3 \u8bed\u6cd5\u3002<\/p>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u5f0f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f7f\u7528 <strong>DevEco Studio\uff084.1+\uff09<\/strong><\/li>\n\n\n\n<li>\u521b\u5efa <strong>\u8de8\u5e73\u53f0\u5e94\u7528\uff08Cross-App\uff09<\/strong><\/li>\n\n\n\n<li>\u9009\u62e9 <strong>Vue<\/strong> \u6a21\u677f \u2192 \u5728\u9e3f\u8499\u5185\u8fd0\u884c Vue3 \u7ec4\u4ef6\uff08\u4e0d\u662f\u6d4f\u89c8\u5668\uff0c\u800c\u662f\u539f\u751f\u6e32\u67d3\uff09<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\ud83d\udee0 2. \u521b\u5efa\u4e00\u4e2a HarmonyOS Vue3 \u9879\u76ee<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">\u7b2c\u4e00\u6b65\uff1a\u521b\u5efa\u9879\u76ee<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u6253\u5f00 <strong>DevEco Studio<\/strong><\/li>\n\n\n\n<li>\u70b9\u51fb\uff1a<strong>New Project<\/strong><\/li>\n\n\n\n<li>\u9009\u62e9\uff1a<br><strong>Cross-App \u2192 Vue<\/strong>\uff08\u4e5f\u53ef\u80fd\u663e\u793a Vue Quick Start\uff09<\/li>\n\n\n\n<li>\u5de5\u7a0b\u540d\uff1a<code>HelloWorld<\/code><\/li>\n\n\n\n<li>\u6700\u4f4e API\uff1aHarmonyOS NEXT API 12 \u6216\u66f4\u9ad8<\/li>\n<\/ol>\n\n\n\n<p>\u9879\u76ee\u6a21\u677f\u4f1a\u5305\u542b Vue3 \u5f00\u53d1\u80fd\u529b\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\ud83d\udcc1 3. Vue3 \u9879\u76ee\u7ed3\u6784\uff08\u9e3f\u8499\u7248\uff09<\/h1>\n\n\n\n<p>\u5178\u578b\u7ed3\u6784\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nentry\/\n \u251c\u2500 src\/\n \u2502   \u251c\u2500 main.ets\n \u2502   \u251c\u2500 pages\/\n \u2502   \u2502    \u2514\u2500 Index.vue\n \u2502   \u2514\u2500 app.ets\n \u251c\u2500 resources\/\n \u251c\u2500 build-profile.json5\n \u2514\u2500 hvigorfile.ts\n\n<\/pre><\/div>\n\n\n<p>\u5176\u4e2d\u6240\u6709 Vue \u9875\u9762\u653e\u5728\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nentry\/src\/pages\/*.vue\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\ud83d\udccc 4. ArkTS + Vue3 HelloWorld \u5b8c\u6574\u4ee3\u7801<\/h1>\n\n\n\n<p>\u4f60\u5c06\u770b\u5230\u4e09\u90e8\u5206\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>main.ets<\/strong> \u2192 \u542f\u52a8\u5165\u53e3<\/li>\n\n\n\n<li><strong>app.ets<\/strong> \u2192 \u5e94\u7528\u914d\u7f6e<\/li>\n\n\n\n<li><strong>Index.vue<\/strong> \u2192 Vue3 \u9875\u9762\uff08Hello World\uff09<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u2705 \u2460 main.ets\uff08\u7a0b\u5e8f\u5165\u53e3\uff09<\/h1>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nimport { createApp } from &#039;@ohos\/vue&#039;;\nimport App from &#039;.\/app.ets&#039;;\n\ncreateApp(App).mount(&#039;#app&#039;);\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u2705 \u2461 app.ets\uff08\u5e94\u7528\u6839\u7ec4\u4ef6\uff09<\/h1>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nexport default {\n  data() {\n    return {};\n  },\n  render() {\n    return (\n      &amp;lt;div class=&quot;container&quot;&gt;\n        &amp;lt;router-view&gt;&amp;lt;\/router-view&gt;\n      &amp;lt;\/div&gt;\n    );\n  }\n}\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u2705 \u2462 Index.vue\uff08\u4f60\u7684 Hello World \u9875\u9762\uff09<\/h1>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\u8fd9\u662f\u9e3f\u8499 Vue3 \u9875\u9762\uff0c\u8bed\u6cd5\u4e0e Web Vue3 \u4e00\u81f4\uff0c\u53ea\u662f\u7ec4\u4ef6\u7531 HarmonyOS \u6e32\u67d3\u3002<\/p>\n<\/blockquote>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;template&gt;\n  &amp;lt;div class=&quot;wrapper&quot;&gt;\n    &amp;lt;text class=&quot;title&quot;&gt;Hello World!&amp;lt;\/text&gt;\n    &amp;lt;text class=&quot;sub&quot;&gt;\u8fd9\u662f Vue3 + HarmonyOS NEXT!&amp;lt;\/text&gt;\n\n    &amp;lt;button class=&quot;btn&quot; @click=&quot;count++&quot;&gt;\n      \u70b9\u51fb\u6211\uff1a{{ count }}\n    &amp;lt;\/button&gt;\n  &amp;lt;\/div&gt;\n&amp;lt;\/template&gt;\n\n&amp;lt;script setup&gt;\nimport { ref } from &#039;vue&#039;;\n\nconst count = ref(0);\n&amp;lt;\/script&gt;\n\n&amp;lt;style&gt;\n.wrapper {\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  height: 100%;\n}\n\n.title {\n  font-size: 40px;\n  font-weight: bold;\n  margin-bottom: 20px;\n}\n\n.sub {\n  font-size: 24px;\n  color: #666;\n  margin-bottom: 40px;\n}\n\n.btn {\n  padding: 16px 32px;\n  background-color: #007dff;\n  color: white;\n  border-radius: 16px;\n}\n&amp;lt;\/style&gt;\n\n<\/pre><\/div>\n\n\n<p>\u8fd0\u884c\u540e\u754c\u9762\u663e\u793a\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nHello World!\n\u8fd9\u662f Vue3 + HarmonyOS NEXT!\n&#x5B; \u70b9\u51fb\u6211\uff1a0 ]\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\ud83c\udfaf 5. \u8fd0\u884c\u4f60\u7684\u5e94\u7528<\/h1>\n\n\n\n<p>\u5728 DevEco Studio \u4e2d\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u9009\u62e9 <strong>HarmonyOS \u6a21\u62df\u5668<\/strong> \u6216 \u771f\u673a\u8fd0\u884c<\/li>\n\n\n\n<li>\u70b9\u51fb Run \u25b6\ufe0f<\/li>\n\n\n\n<li>\u770b\u5230 HelloWorld \u9875\u9762\u6210\u529f\u8fd0\u884c<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u26a1 6. \u5e38\u89c1\u95ee\u9898\uff08\u975e\u5e38\u91cd\u8981\uff09<\/h1>\n\n\n\n<h3 class=\"wp-block-heading\">\u2753 \u662f\u5426\u53ef\u4ee5\u4f7f\u7528 ElementPlus\u3001Vant \u7b49 WebUI\uff1f<\/h3>\n\n\n\n<p>\u27a4 <strong>\u4e0d\u80fd<\/strong><br>HarmonyOS \u7684 Vue3 \u662f\u201c\u539f\u751f\u6e32\u67d3\u201d\uff0c\u4e0d\u662f WebView\u3002<\/p>\n\n\n\n<p>\u4f7f\u7528\u5fc5\u987b\u9009\u7528\uff1a<\/p>\n\n\n\n<p>\u2714 \u9e3f\u8499\u539f\u751f\u7ec4\u4ef6\uff08ArkUI\uff09<br>\u2714 \u5b98\u65b9 Cross-UI \u89c4\u8303<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u2753 setup() \u91cc\u80fd\u7528 Vue3 \u6240\u6709\u7279\u6027\u5417\uff1f<\/h3>\n\n\n\n<p>\u7edd\u5927\u591a\u6570\u53ef\u4ee5\uff0c\u5305\u62ec\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>reactive \/ ref<\/li>\n\n\n\n<li>computed<\/li>\n\n\n\n<li>watch<\/li>\n\n\n\n<li>v-model<\/li>\n\n\n\n<li>props \/ emits<\/li>\n\n\n\n<li>\u751f\u547d\u5468\u671f\uff08onMounted \u7b49\uff09<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u2753 \u80fd\u8c03\u539f\u751f\u80fd\u529b\u5417\uff1f<\/h3>\n\n\n\n<p>\u53ef\u4ee5\uff0c\u4f7f\u7528 ArkTS API\uff0c\u4f8b\u5982\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nimport router from &#039;@ohos.router&#039;;\n\nrouter.pushUrl({\n  url: &#039;pages\/Detail&#039;\n});\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\ud83c\udf81 7. \u5b8c\u6574\u53ef\u8fd0\u884c\u5de5\u7a0b\uff08\u590d\u5236\u5373\u53ef\uff09<\/h1>\n\n\n\n<p>\u5982\u679c\u4f60\u613f\u610f\uff0c\u6211\u53ef\u4ee5\u4e3a\u4f60\u751f\u6210\uff1a<\/p>\n\n\n\n<p>\u2728 \u76f4\u63a5\u53ef\u8fd0\u884c\u7684\u5b8c\u6574 DevEco Studio \u9879\u76ee\u7ed3\u6784<br>\u2728 \u8be6\u7ec6\u7684\u8de8\u7aef Vue3 + ArkTS \u793a\u4f8b\u7ec4\u4ef6<br>\u2728 \u589e\u52a0\u8def\u7531\u3001\u7f51\u7edc\u8bf7\u6c42\u3001\u5b58\u50a8\u3001\u539f\u751f\u80fd\u529b\u8c03\u7528<br>\u2728 \u5c01\u88c5\u4e00\u4e2a\u9e3f\u8499\u7248\u7684 mini Vue UI \u7ec4\u4ef6\u5e93<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0b\u9762\u7ed9\u4f60\u4e00\u7bc7 \u300a\u4f7f\u7528 Vue3 \u5f00\u53d1\u9e3f\u8499 HarmonyOS NEXT \u7684 He&#8230; <a class=\"more-link\" href=\"https:\/\/www.52runoob.com\/index.php\/2025\/12\/07\/%e4%bd%bf%e7%94%a8vue3%e5%bc%80%e5%8f%91%e9%b8%bf%e8%92%99%e7%9a%84helloworld%e9%99%84%e8%af%a6%e7%bb%86%e5%ae%9e%e7%8e%b0%e4%bb%a3%e7%a0%81\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49],"tags":[],"class_list":["post-591","post","type-post","status-publish","format-standard","hentry","category-javascript"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/591","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/comments?post=591"}],"version-history":[{"count":1,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/591\/revisions"}],"predecessor-version":[{"id":592,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/591\/revisions\/592"}],"wp:attachment":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/media?parent=591"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/categories?post=591"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/tags?post=591"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}