{"id":101007,"date":"2020-05-21T03:00:26","date_gmt":"2020-05-20T19:00:26","guid":{"rendered":"http:\/\/4563.org\/?p=101007"},"modified":"2020-05-21T03:00:26","modified_gmt":"2020-05-20T19:00:26","slug":"vue-%e8%90%8c%e6%96%b0%e6%b1%82%e5%8a%a9%ef%bc%81%e4%b8%ba%e5%95%a5-template-%e4%b8%8d%e8%83%bd%e6%9b%bf%e6%8d%a2%e6%8e%89-%e7%9b%b8%e5%ba%94%e7%9a%84-tag","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=101007","title":{"rendered":"vue \u840c\u65b0\u6c42\u52a9\uff01\u4e3a\u5565 template \u4e0d\u80fd\u66ff\u6362\u6389 \u76f8\u5e94\u7684 tag"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  vue \u840c\u65b0\u6c42\u52a9\uff01\u4e3a\u5565 template \u4e0d\u80fd\u66ff\u6362\u6389 \u76f8\u5e94\u7684 tag               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : asanelder <\/span>  <span><i><\/i> 1<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<h2>index.html<\/h2>\n<p> &lt;html&gt; &lt;head&gt; &lt;title&gt;Vue Hello World&lt;\/title&gt; &lt;\/head&gt; &lt;body&gt;       <\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>17<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"1669500\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : SilentDepth <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5982\u679c\u4f60\u53d1\u51fa\u6765\u7684\u4ee3\u7801\u6ca1\u9519\u7684\u8bdd\uff0c\u4f60\u7684\u6d4f\u89c8\u5668\u63a7\u5236\u53f0\u5e94\u8be5\u6709\u62a5\u9519\u3002\u4f60\u63d0\u4f9b\u7684 template \u503c\u538b\u6839\u513f\u4e0d\u662f\u4e2a\u5408\u6cd5\u503c\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1669501\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : asanelder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @SilentDepth \u7b2c\u4e00\u6b21\u53d1\uff0c\u4ee3\u7801\u683c\u5f0f\u9519\u4e86\uff0c\u6211\u53c8\u53d1\u4e86\u4e00\u4e2a\u5e16\u5b50                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1669502\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : JayLin1011 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @asanelder `new Vue({ el: &#8216;#app&#8217; })`\uff0c\u53bb\u6389\u5f8c\u9762\u7684 `template: &#8216;test&#8217;`\uff0c\u4f60\u7684\u914d\u7f6e\u885d\u7a81\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1669503\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ericgui <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5176\u5b9e\u6211\u89c9\u7740\u5f00\u4e2a\u7ebf\u4e0b debug \u8f85\u5bfc\u73ed\u4e5f\u633a\u597d\u7684<br \/>\u6838\u5fc3\u4e0d\u662f\u5b66\u4e60\u6750\u6599<br \/>\u800c\u662f\u5e2e\u4f60 debug<br \/>\u4f60\u624d\u80fd\u6210\u957f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1669504\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : azh7138m <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9<br \/>\u4e0d\u662f<br \/>\u6587\u6863\u90fd\u4e0d\u770b<br \/>\u5bfc\u81f4\u7684\u5417<br \/>\u548c debug \u6709\u5565\u5173\u7cfb\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1669505\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zhw2590582 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f18\u5148\u7ea7\u95ee\u9898\u800c\u5df2\uff0c\u4f60\u7528\u4e86 el\uff0c\u540e\u9762\u7684 template \u5c31\u65e0\u6548\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1669506\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : SilentDepth <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0a\u51e0\u4f4d\u53ef\u80fd\u8bb0\u9519\u4e86\u3002\u5f53\u7ec4\u4ef6\u9009\u9879\u540c\u65f6\u5305\u542b el \u548c template \u65f6\uff0cel \u89c6\u4e3a\u6302\u8f7d\u70b9\uff0ctemplate \u89c6\u4e3a\u6a21\u677f\u5185\u5bb9\uff0c\u6240\u4ee5\u4e0d\u5b58\u5728 template \u65e0\u6548\u7684\u95ee\u9898\u3002\u4e3b\u7684\u95ee\u9898\u662f\uff0ctemplate \u7684\u503c\u9700\u8981\u662f\u4e00\u4e2a DOM \u7ed3\u6784\uff08\u4ee5\u7f16\u8bd1\u6210 render \u51fd\u6570\uff09\uff0c\u800c\u4e3b\u7684\u4ee3\u7801\u5199\u7684\u662f &#8220;test&#8221;\uff0c\u8fd9\u6ca1\u6cd5\u7f16\u8bd1\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1669507\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : duanzhihe <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u7684 template \u7528\u6cd5\u6ca1\u6709\u95ee\u9898\uff0c\u4f46\u770b\u4f60\u7684 main.js \uff0c\u611f\u89c9\u50cf\u662f\u4f60\u628a vue \u5229\u7528\u811a\u624b\u67b6\u5199\uff0c\u548c\u76f4\u63a5 script \u6807\u7b7e\u5f15\u7528 vue.js \u6587\u4ef6\u7684\u5199\u6cd5\u641e\u6df7\u4e86\uff01\u4f60\u82e5\u662f\u6ca1\u6709\u7528 vue \u811a\u624b\u67b6\uff0c\u76f4\u63a5\u627e\u4e00\u4e2a vue \u7684 cdn \u5229\u7528 script \u6807\u7b7e\u5f15\u5165\uff0cmain.js \u6587\u4ef6\u5220\u9664\u201cmport Vue from &#8216;vue&#8217;;\u201d\u8fd9\u4e00\u884c\u5e94\u8be5\u5c31\u53ef\u4ee5\u4e86\u3002\u82e5\u662f\u4f60\u7528\u4e86\u811a\u624b\u67b6\uff0c\u611f\u89c9\u548c\u4f60\u6cbe\u51fa\u6765\u7684\u4ee3\u7801\u4e0d\u592a\u50cf\uff5e\uff5e\uff5e\u4f60\u9700\u8981\u597d\u597d\u770b\u770b\u6587\u6863\u600e\u4e48\u56de\u4e8b\uff01                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1669508\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : JayLin1011 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @zhw2590582 \u4e8b\u5be6\u4e0a\uff0ctemplate \u548c render() \u512a\u5148\u7d1a\u6bd4 el \u9ad8\uff0c\u4f46\u662f\u9019\u88e1\u7684 template \u662f\u7121\u6548\u7684\uff0c\u56e0\u70ba\u5b83\u65e2\u4e0d\u662f\u4e00\u500b\u5b57\u7b26\u4e32\u6a21\u677f\u4e5f\u4e0d\u662f\u4e00\u500b\u5b57\u7b26\u4e32\u6a21\u677f\u9078\u64c7\u7b26\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1669509\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : asanelder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @JayLin1011 \u4e0d\u597d\u610f\u601d\u554a\uff0c\u7b2c\u4e00\u6b21\u53d1\u8d34\u5b50\uff0c\u6ca1\u6ce8\u610f md \u683c\u5f0f\uff0c\u4ee3\u7801\u683c\u5f0f\u641e\u9519\u4e86\uff0c\u6211\u53c8\u91cd\u65b0\u53d1\u4e86\u4e00\u4e2a\uff0c\u5ffd\u7565\u4e0a\u9762\u7684\u5427\u3002\u3002\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1669510\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : asanelder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @azh7138m \u4e0d\u597d\u610f\u601d\u554a\uff0c\u7b2c\u4e00\u6b21\u53d1\u8d34\u5b50\uff0c\u6ca1\u6ce8\u610f md \u683c\u5f0f\uff0c\u4ee3\u7801\u683c\u5f0f\u641e\u9519\u4e86\uff0c\u6211\u53c8\u91cd\u65b0\u53d1\u4e86\u4e00\u4e2a\uff0c\u5ffd\u7565\u4e0a\u9762\u7684\u5427\u3002\u3002\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1669511\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : asanelder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @SilentDepth \u4e0d\u597d\u610f\u601d\u554a\uff0c\u7b2c\u4e00\u6b21\u53d1\u8d34\u5b50\uff0c\u6ca1\u6ce8\u610f md \u683c\u5f0f\uff0c\u4ee3\u7801\u683c\u5f0f\u641e\u9519\u4e86\uff0c\u6211\u53c8\u91cd\u65b0\u53d1\u4e86\u4e00\u4e2a\uff0c\u5ffd\u7565\u4e0a\u9762\u7684\u5427\u3002\u3002\u3002\u3002\u6211\u5199\u7684 template \u786e\u5b9e\u662f\u4e00\u4e2a DOM\uff0c\u95ee\u9898\u5c31\u662f\uff0c\u6700\u540d\u6ca1\u6709\u6302\u8f7d\u5230 el \u6240\u6307\u5b9a\u7684 element \u4e0a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1669512\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : asanelder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @duanzhihe \u4e0d\u597d\u610f\u601d\u554a\uff0c\u7b2c\u4e00\u6b21\u53d1\u8d34\u5b50\uff0c\u6ca1\u6ce8\u610f md \u683c\u5f0f\uff0c\u4ee3\u7801\u683c\u5f0f\u641e\u9519\u4e86\uff0c\u6211\u53c8\u91cd\u65b0\u53d1\u4e86\u4e00\u4e2a\uff0c\u5ffd\u7565\u4e0a\u9762\u7684\u5427\u3002\u3002\u3002\u3002\u6211\u5199\u7684 template \u786e\u5b9e\u662f\u4e00\u4e2a DOM\uff0c\u95ee\u9898\u5c31\u662f\uff0c\u6700\u540d\u6ca1\u6709\u6302\u8f7d\u5230 el \u6240\u6307\u5b9a\u7684 element \u4e0a\u3002<\/p>\n<p>\u6211\u81ea\u5df1\u60f3\u7528 webpack \u6765\u6253\u5305\u4e00\u4e2a\u7b80\u5355\u7684 vue single file components\uff0c\u76ee\u7684\u5c31\u662f\u60f3\u4e86\u89e3\u4e00\u4e0b\u539f\u7406\u3002\u3002\u3002<\/p>\n<p>\u8bf4\u5b9e\u8bdd\uff0c\u770b\u5b98\u65b9\u6587\u6863\u6ca1\u627e\u5230\u539f\u56e0\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1669513\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : duanzhihe <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @asanelder \u4f60\u6ca1\u7528 vue \u5b98\u65b9\u7684 demo\uff0c\u76f4\u63a5\u81ea\u5df1\u5199\u7684 webpack \u914d\u7f6e\u6765\u8dd1\u7684 vue \u9879\u76ee\uff1f\u662f\u7684\u8bdd\uff0c\u53ef\u4ee5\u628a\u4f60\u7684 webpack \u914d\u7f6e\u6587\u4ef6\u53d1\u51fa\u6765\u770b\u770b\uff01<br \/>\u4f60\u82e5\u662f\u521d\u5b66\u8005\uff0c\u4e0d\u5efa\u8bae\u81ea\u5df1\u53bb\u641e\u8fd9\u4e9b\uff0c\u9700\u8981\u4e86\u89e3 webpack \u548c node \u7684\u4e1c\u897f\u8f83\u591a\uff0c\u611f\u89c9\u4f60\u5148\u8ba9\u9879\u76ee\u8dd1\u8d77\u6765\u518d\u4e86\u89e3\u6bd4\u8f83\u597d\uff01<br \/>\u6211\u8fd9\u79cd\u6bd4\u8f83\u61d2\u7684\uff0c\u4e00\u822c\u60c5\u51b5\u90fd\u4f1a\u7528 vue \u7684\u5b98\u65b9 demo \u6765\u4fee\u6539\u540e\u505a\u9879\u76ee\uff0c\u5177\u4f53\u7684\u53ef\u4ee5\u770b\u770b vue \u811a\u624b\u67b6\u7684\u76f8\u5173\u6587\u6863\uff08 vue-cli \uff09\uff0c\u6216\u8005\u76f4\u63a5\u4e0a github \u627e vue \u7684\u5b98\u65b9 demo \uff01                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1669514\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : asanelder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @duanzhihe \u54c8\u54c8\uff0c\u611f\u8c22\u56de\u590d\uff0c\u6211\u81ea\u5df1\u6700\u8fd1\u53ea\u662f\u60f3\u4e86\u89e3\u524d\u7aef\u7684\u4e00\u4e9b\u4e1c\u897f\uff0c\u4e4b\u524d\u628a node \u548c webpack \u4e4b\u7c7b\u7684\u6587\u6863\u4e5f\u5927\u6982\u770b\u4e86\u4e00\u4e0b\uff0c\u6628\u5929\u770b\u4e86 vue \u7684\u6587\u6863\uff0c\u60f3\u7740\u4e0d\u4f7f\u7528 vue-cli \u6765\u81ea\u5df1 build \u4e00\u4e2a\u7b80\u5355\u7684 demo \u3002\u3002\u3002\u53ef\u80fd\u662f\u81ea\u5df1\u5bf9\u4e00\u4e9b\u7ec6\u8282\u7684\u4e1c\u897f\u4e86\u89e3\u7684\u4e0d\u6e05\u695a\uff0c\u6240\u4ee5\u624d\u6709\u4e86\u4ee5\u4e0a\u7684\u95ee\u9898                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1669515\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jingcoco <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u4e5f\u4e00\u76f4\u662f\u7528\u7684\u5b98\u65b9 demo\uff0c\u6ca1\u600e\u4e48\u60f3\u8fc7\u3002\u3002\u3002\u3002\u4f46\u662f\u6211\u4e2a\u4eba\u611f\u89c9\u4f60\u7684\u95ee\u9898\u662f\uff1a<br \/>1. \u5982\u679c\u8981\u6539\u53d8 html \u6587\u4ef6\uff0c\u6211\u611f\u89c9\u662f\u7528\u7684 webpack loader \u201chtml-webpack-plugin\u201d\uff0c\u611f\u89c9\u76f8\u5173\u8f6c\u53d8\u90fd\u5728 js \u91cc\u9762\u4f53\u73b0\u3002<br \/>2. \u6211\u611f\u89c9\u4f60\u662f\u6df7\u7528\u4e86 browser \u548c vue-cli \u7684\u4e24\u79cd vue \u5f00\u53d1\u7684 demo \u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1669516\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : asanelder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u627e\u5230\u539f\u56e0\u4e86\u3002<\/p>\n<p>\u4e3b\u8981\u662f webpack \u6700\u540e\u6253\u5305\u6210\u7684 bundle.js \u4e0d\u5305\u542b vue-compile, \u6240\u4ee5 template: &#8216;&lt;p&gt; test &lt;\/p&gt;&#8217; \u662f\u4e0d\u8d77\u4f5c\u7528\u7684\u3002<\/p>\n<p>\u8981\u60f3\u8d77\u4f5c\u7528\uff0c\u9700\u8981\u4f7f\u7528 SFC \u6216\u8005 render \u51fd\u6570\u3002<\/p>\n<p>\u5927\u5bb6\u4e0d\u7528\u56de\u590d\u4e86\u54c8                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>vue \u840c\u65b0\u6c42\u52a9\uff01\u4e3a\u5565 templ&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/101007"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=101007"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/101007\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=101007"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=101007"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=101007"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}