{"id":970,"date":"2023-03-23T22:41:43","date_gmt":"2023-03-23T14:41:43","guid":{"rendered":""},"modified":"2023-03-23T22:41:43","modified_gmt":"2023-03-23T14:41:43","slug":"Vue.js \u5165\u95e8","status":"publish","type":"post","link":"https:\/\/bianchenghao6.com\/970.html","title":{"rendered":"Vue.js \u5165\u95e8"},"content":{"rendered":"
\n
Grammarly<\/span> \u6253\u5f00Node.js\u547d\u4ee4\u63d0\u793a\u7b26\u5e76\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4: <\/span> <\/p>\n \u8fd0\u884c vue create myfirstapp <\/strong>\u547d\u4ee4\u4ee5\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a\u7684\u5e94\u7528<\/span> \u5728Node.js\u547d\u4ee4\u63d0\u793a\u7b26\u4e0b\u8fd0\u884c vue create myfirstapp <\/strong>\u547d\u4ee4\u3002<\/span> <\/body>
\n Netflix <\/span>
\n Laracast <\/span>
\n Behance <\/span>
\n Gitlab <\/span>
\n Euronews <\/span>
\n Codeship<\/span>
\n Livestorm<\/span>
\n Wizzair\u7b49<\/span> <\/p>\n\u68c0\u67e5\u5df2\u5b89\u88c5\u7684Vue.js\u7684\u7248\u672c<\/h2>\n
vue --version
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n
\n \u5982\u679c\u54cd\u5e94\u826f\u597d\uff0c\u8bf7\u7ee7\u7eed\u6267\u884c\u4e0b\u4e00\u6b65\u4ee5\u521b\u5efa\u65b0\u9879\u76ee\u3002\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u60a8\u53ef\u4ee5\u770b\u5230Vue.js\u7248\u672c2.9.6\u5df2\u6210\u529f\u5b89\u88c5\u3002\u73b0\u5728\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u521b\u5efa\u4e00\u4e2a\u65b0\u9879\u76ee: <\/span> <\/p>\n vue create <YourAppName>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n
\n \u60a8\u5df2\u7ecf\u770b\u5230vue create\u547d\u4ee4\u4ec5\u9002\u7528\u4e8eVue CLI 3\u7684\u9519\u8bef\uff0c\u5e76\u4e14\u60a8\u4f7f\u7528\u7684\u662f\u65e7\u7248\u672c\u3002\u73b0\u5728\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5378\u8f7d\u65e7\u7248\u672c\u5e76\u5b89\u88c5\u65b0\u7248\u672c\u3002<\/span> <\/p>\n npm uninstall -g vue-cli
npm install -g @vue\/cli
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n
\n \u60a8\u4f1a\u770b\u5230Vue.js\u7684\u65e7\u7248\u672c\u5df2\u5378\u8f7d\u3002\u73b0\u5728\uff0c\u5b89\u88c5\u8f83\u65b0\u7684\u7248\u672c\u3002<\/span>
\n
\n
\n
\n \u73b0\u5728\uff0c\u5df2\u5b89\u88c5\u8f83\u65b0\u7248\u672c\u7684Vue CLI\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528 vue --version <\/strong> \u68c0\u67e5Vue CLI\u7248\u672c<\/span>
\n
\n \u60a8\u53ef\u4ee5\u770b\u5230\u5df2\u5b89\u88c5\u6700\u65b0\u7684Vue CLI\u7248\u672c\u3002\u73b0\u5728\uff0c\u8fd0\u884c vue create myfirstapp <\/strong>\u547d\u4ee4\u521b\u5efa\u4e00\u4e2a\u5e94\u7528<\/span> <\/p>\n\u521b\u5efaVue.js\u7b2c\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f(\u4f7f\u7528vue\u521b\u5efa\u547d\u4ee4)<\/h3>\n
\n
\n \u6b64\u8fc7\u7a0b\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\u3002\u7b49\u5f85\u76f4\u5230\u521b\u5efa\u5e94\u7528\u7a0b\u5e8f\u8fc7\u7a0b\u5b8c\u6210\u3002\u6210\u529f\u5b8c\u6210\u540e\uff0c\u60a8\u5c06\u5728\u547d\u4ee4\u884c\u4e0a\u770b\u5230\u4e00\u6761\u6d88\u606f\uff0c\u8bf4\u660e\u5df2\u6210\u529f\u521b\u5efa\u9879\u76ee\u3002<\/span>
\n
\n \u73b0\u5728\uff0c\u901a\u8fc7\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u8f6c\u5230\u5e94\u7528\u7a0b\u5e8f\u7684\u4f4d\u7f6e\u3002<\/span> <\/p>\n cd myfirstapp
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n
\n \u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u5728\u6d4f\u89c8\u5668\u4e0a\u8fd0\u884cVue.js\u5e94\u7528\u3002<\/span> <\/p>\n npm run serve
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n
\n \u5728\u8fd9\u91cc\uff0c\u60a8\u53ef\u4ee5\u770b\u5230\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u5df2\u6210\u529f\u7f16\u8bd1\uff0c\u5e76\u4e14\u5f00\u53d1\u670d\u52a1\u5668\u5df2\u542f\u52a8\u3002\u590d\u5236\u672c\u5730\u5730\u5740\u5e76\u5c06\u5176\u7c98\u8d34\u5230\u60a8\u7684Google Chrome\u6d4f\u89c8\u5668\u4e2d\u4ee5\u6253\u5f00\u5e94\u7528\u3002<\/span>
\n <\/p>\n
\u6d4f\u89c8\u6587\u4ef6\u5939\u7ed3\u6784Vue\u5e94\u7528\u7a0b\u5e8f<\/h3>\n
\n \u9009\u62e9\u4e86Visual Studio Code IDE <\/strong>\u6765\u90e8\u7f72\u6211\u4eec\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\n <\/div>\n
\n public <\/strong>\u6587\u4ef6\u5939\u4ee5\u53ca
\n src <\/strong>\u6587\u4ef6\u5939\u3002\u8fd9\u4e24\u4e2a\u6587\u4ef6\u5939\u5305\u542b\u60a8\u9879\u76ee\u4e2d\u6700\u91cd\u8981\u7684\u6587\u4ef6\u3002\n <\/div>\n <\/p>\n
<!DOCTYPE html>
<html lang=\"en\">
<head><\/span>
<meta charset=\"utf-8\">
<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">
<meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\">
<link rel=\"icon\" href=\"<%= BASE_URL %>favicon.ico\">
<title><\/span><%= htmlWebpackPlugin.options.title %><\/title><\/span>
<\/head><\/span>
<body><\/span>
<noscript><\/span>
<strong><\/span>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.<\/strong><\/span>
<\/noscript><\/span>
<div id=\"app\"><\/div><\/span>
<!-- built files will be auto injected -->
<\/body><\/span>
<\/html><\/span>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n <\/p>\n
import Vue from 'vue'
import App from '.\/App.vue'
Vue.config.productionTip = false
new Vue({
render: h => h(App),
}).$mount('#app')
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n <\/p>\n
\n HTML\uff0cCSS\u548cJAVASCRIPT <\/strong>\u3002\u5b83\u7528\u4e8e\u7ba1\u7406\u5e94\u7528\u7a0b\u5e8f\u7684\u5355\u4e2a\u6587\u4ef6\u7ec4\u4ef6\u3002\n <\/div>\n <template>
<div id=\"app\">
<img alt=\"Vue logo\" src=\".\/assets\/logo.png\">
<HelloWorld msg=\"Welcome to Your Vue.js App\"\/>
<\/div><\/span>
<\/template>
<script><\/span>
import HelloWorld from '.\/components\/HelloWorld.vue'
export default {
name: 'App',a
components: {
HelloWorld
}
}
<\/script><\/span>
<style><\/span>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
<\/style><\/span>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n <\/p>\n
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
<\/style><\/span>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n CSS \u9650\u5236\u4e3a\u4ec5\u6b64\u7ec4\u4ef6\u3002\u4f7f\u7528<style scoped>\u5c5e\u6027\u540e\uff0c\u60a8\u7684CSS\u5c06\u4e0d\u4f1a\u6cc4\u6f0f\u5230\u53e6\u4e00\u90e8\u5206\u3002\n <\/div>\n <\/p>\n
< script> <\/span>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
<\/script> <\/span>
<\/span><\/code><\/pre>\n<\/p><\/div>\n
\n <\/p>\n
\n
\n<\/html><\/p>\n","protected":false},"excerpt":{"rendered":"Vue.js \u5165\u95e8zh-cn","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[122],"tags":[],"class_list":["post-970","post","type-post","status-publish","format-standard","hentry","category-vuejc"],"_links":{"self":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/970"}],"collection":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/comments?post=970"}],"version-history":[{"count":0,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/970\/revisions"}],"wp:attachment":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/media?parent=970"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/categories?post=970"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/tags?post=970"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}