{"id":7842,"date":"2023-11-28T20:01:16","date_gmt":"2023-11-28T12:01:16","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=7842"},"modified":"2023-12-01T23:08:30","modified_gmt":"2023-12-01T15:08:30","slug":"vue-zhongjs-zhong-you-na-xie-bu-tong-lei-xing-de-d","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/11\/28\/vue-zhongjs-zhong-you-na-xie-bu-tong-lei-xing-de-d\/","title":{"rendered":"Vue \u4e2d JS \u4e2d\u6709\u54ea\u4e9b\u4e0d\u540c\u7c7b\u578b\u7684\u5f39\u51fa\u6846\u53ef\u7528\uff1f"},"content":{"rendered":"<p>\u5728 Vue \u4e2d\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e0d\u540c\u7c7b\u578b\u7684\u5f39\u51fa\u6846\u6765\u663e\u793a\u6d88\u606f\u3001\u8b66\u544a\u3001\u786e\u8ba4\u4fe1\u606f\u6216\u81ea\u5b9a\u4e49\u5185\u5bb9\u3002\u8fd9\u4e9b\u5f39\u51fa\u6846\u53ef\u4ee5\u901a\u8fc7\u539f\u751f JavaScript \u7684 <code>alert()<\/code>\u3001<code>confirm()<\/code>\u3001<code>prompt()<\/code> \u65b9\u6cd5\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528 Vue \u63d2\u4ef6\u6216\u7ec4\u4ef6\u6765\u5b9e\u73b0\u3002<\/p>\n<h3><a id=\"%E5%8E%9F%E7%94%9Fjavascript%E5%BC%B9%E5%87%BA%E6%A1%86%EF%BC%9A\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u539f\u751f JavaScript \u5f39\u51fa\u6846\uff1a<\/h3>\n<ol>\n<li><strong>alert()\uff1a<\/strong> \u663e\u793a\u5e26\u6709\u4e00\u6bb5\u6d88\u606f\u548c\u4e00\u4e2a\u201c\u786e\u5b9a\u201d\u6309\u94ae\u7684\u5bf9\u8bdd\u6846\uff0c\u7528\u4e8e\u5411\u7528\u6237\u663e\u793a\u4e00\u4e9b\u4fe1\u606f\u3002<\/li>\n<\/ol>\n<pre><code class=\"language-javascript\">alert('Hello, Vue!');\n<\/code><\/pre>\n<ol start=\"2\">\n<li><strong>confirm()\uff1a<\/strong> \u663e\u793a\u5e26\u6709\u6d88\u606f\u3001\u201c\u786e\u5b9a\u201d\u548c\u201c\u53d6\u6d88\u201d\u6309\u94ae\u7684\u5bf9\u8bdd\u6846\uff0c\u7528\u6237\u53ef\u4ee5\u9009\u62e9\u786e\u8ba4\u6216\u53d6\u6d88\u64cd\u4f5c\u3002<\/li>\n<\/ol>\n<pre><code class=\"language-javascript\">if (confirm('Are you sure?')) {\n  \/\/ \u7528\u6237\u70b9\u51fb\u4e86\u786e\u5b9a\u6309\u94ae\n} else {\n  \/\/ \u7528\u6237\u70b9\u51fb\u4e86\u53d6\u6d88\u6309\u94ae\n}\n<\/code><\/pre>\n<ol start=\"3\">\n<li><strong>prompt()\uff1a<\/strong> \u663e\u793a\u5e26\u6709\u6d88\u606f\u3001\u6587\u672c\u8f93\u5165\u6846\u548c\u201c\u786e\u5b9a\u201d\u3001\u201c\u53d6\u6d88\u201d\u6309\u94ae\u7684\u5bf9\u8bdd\u6846\uff0c\u7528\u4e8e\u63a5\u6536\u7528\u6237\u7684\u8f93\u5165\u3002<\/li>\n<\/ol>\n<pre><code class=\"language-javascript\">const userInput = prompt('Please enter your name:', 'John Doe');\n<\/code><\/pre>\n<h3><a id=\"vue%E6%8F%92%E4%BB%B6%E6%88%96%E7%BB%84%E4%BB%B6%EF%BC%9A\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>Vue \u63d2\u4ef6\u6216\u7ec4\u4ef6\uff1a<\/h3>\n<ol>\n<li><strong>Element UI \u7684 MessageBox\uff1a<\/strong> Element UI \u63d0\u4f9b\u4e86 MessageBox \u7ec4\u4ef6\uff0c\u53ef\u4ee5\u8f7b\u677e\u521b\u5efa\u8b66\u544a\u3001\u786e\u8ba4\u548c\u6d88\u606f\u5f39\u51fa\u6846\u3002<\/li>\n<\/ol>\n<pre><code class=\"language-javascript\">this.$confirm('Are you sure?')\n  .then(() =&gt; {\n    \/\/ \u7528\u6237\u70b9\u51fb\u4e86\u786e\u5b9a\u6309\u94ae\n  })\n  .catch(() =&gt; {\n    \/\/ \u7528\u6237\u70b9\u51fb\u4e86\u53d6\u6d88\u6309\u94ae\n  });\n<\/code><\/pre>\n<ol start=\"2\">\n<li><strong>Mint UI \u7684 Toast\uff1a<\/strong> Mint UI \u63d0\u4f9b\u4e86 Toast \u7ec4\u4ef6\uff0c\u7528\u4e8e\u663e\u793a\u7b80\u77ed\u7684\u6d88\u606f\u63d0\u793a\u3002<\/li>\n<\/ol>\n<pre><code class=\"language-javascript\">this.$toast('Hello, Vue!');\n<\/code><\/pre>\n<ol start=\"3\">\n<li><strong>Vuetify \u7684 Snackbar\uff1a<\/strong> Vuetify \u63d0\u4f9b\u4e86 Snackbar \u7ec4\u4ef6\uff0c\u7528\u4e8e\u663e\u793a\u901a\u77e5\u6d88\u606f\u6216\u8b66\u544a\u3002<\/li>\n<\/ol>\n<pre><code class=\"language-javascript\">this.$snackbar.show('Hello, Vue!');\n<\/code><\/pre>\n<p>\u8fd9\u4e9b\u5f39\u51fa\u6846\u53ef\u6839\u636e\u9879\u76ee\u9700\u6c42\u548c\u8bbe\u8ba1\u98ce\u683c\u8fdb\u884c\u9009\u62e9\uff0c\u7528\u6765\u5411\u7528\u6237\u663e\u793a\u4e0d\u540c\u7c7b\u578b\u7684\u6d88\u606f\u3001\u8b66\u544a\u3001\u786e\u8ba4\u4fe1\u606f\u6216\u63a5\u6536\u7528\u6237\u8f93\u5165\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 Vue \u4e2d\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e0d\u540c\u7c7b\u578b\u7684\u5f39\u51fa\u6846\u6765\u663e\u793a\u6d88\u606f\u3001\u8b66\u544a\u3001\u786e\u8ba4\u4fe1\u606f\u6216\u81ea\u5b9a\u4e49\u5185\u5bb9\u3002\u8fd9\u4e9b\u5f39\u51fa\u6846\u53ef\u4ee5\u901a\u8fc7\u539f\u751f Ja [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[114],"tags":[],"class_list":["post-7842","post","type-post","status-publish","format-standard","hentry","category-vue"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/7842","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/comments?post=7842"}],"version-history":[{"count":2,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/7842\/revisions"}],"predecessor-version":[{"id":13969,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/7842\/revisions\/13969"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=7842"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=7842"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=7842"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}