我的天,又忘记了这个命令,应该是vue create stawb啊,在刚才新建的文件夹hami99下建

news/2024/7/10 0:24:59 标签: vue

6、第一次想用

cnpm install

无果,报错,说没有package.json,罢

npminstall WARN package.json not exists: /Users/ivyone/hami99/package.json

7、又想用

vue start

也无果,报“
Unknown command start.”错误

8、搜了一下,终于看到是

vue create package

了,
终于报成功了

success Saved lockfile.

8、下次不要再忘了哦,
但愿。

记录全部

ivyone@ivyonedeMacBook-Pro hami99 % cnpm install
npminstall WARN package.json not exists: /Users/ivyone/hami99/package.json
✔ Installed 0 packages
✔ Linked 0 latest versions
✔ Run 0 scripts
✔ All packages installed (used 6ms(network 4ms), speed 0B/s, json 0(0B), tarball 0B)
ivyone@ivyonedeMacBook-Pro hami99 % vue start
Usage: vue <command> [options]

Options:
  -V, --version                              output the version number
  -h, --help                                 output usage information

Commands:
  create [options] <app-name>                create a new project powered by vue-cli-service
  add [options] <plugin> [pluginOptions]     install a plugin and invoke its generator in an already created project
  invoke [options] <plugin> [pluginOptions]  invoke the generator of a plugin in an already created project
  inspect [options] [paths...]               inspect the webpack config in a project with vue-cli-service
  serve [options] [entry]                    serve a .js or .vue file in development mode with zero config
  build [options] [entry]                    build a .js or .vue file in production mode with zero config
  ui [options]                               start and open the vue-cli ui
  init [options] <template> <app-name>       generate a project from a remote template (legacy API, requires @vue/cli-init)
  config [options] [value]                   inspect and modify the config
  outdated [options]                         (experimental) check for outdated vue cli service / plugins
  upgrade [options] [plugin-name]            (experimental) upgrade vue cli service / plugins
  migrate [options] [plugin-name]            (experimental) run migrator for an already-installed cli plugin
  info                                       print debugging information about your environment

  Run vue <command> --help for detailed usage of given command.

  Unknown command start.

ivyone@ivyonedeMacBook-Pro hami99 % vue create stawb  


Vue CLI v4.5.11
? Please pick a preset: Default (Vue 3 Preview) ([Vue 3] babel, eslint)


Vue CLI v4.5.11
✨  Creating project in /Users/ivyone/hami99/stawb.
🗃  Initializing git repository...
⚙️  Installing CLI plugins. This might take a while...

yarn install v1.22.10
info No lockfile found.
[1/4] 🔍  Resolving packages...



success Saved lockfile.
✨  Done in 22.64s.
🚀  Invoking generators...
📦  Installing additional dependencies...

yarn install v1.22.10
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
success Saved lockfile.
✨  Done in 7.18s.
⚓  Running completion hooks...

📄  Generating README.md...

🎉  Successfully created project stawb.
👉  Get started with the following commands:

 $ cd stawb
 $ yarn serve

ivyone@ivyonedeMacBook-Pro hami99 % 

ivyone@ivyonedeMacBook-Pro hami99 % cd stawb
ivyone@ivyonedeMacBook-Pro stawb % cnpm run serve

记录一下三个文件
html

<!DOCTYPE html>
<html lang="">
  <head>
    <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><%= htmlWebpackPlugin.options.title %></title>
  </head>
  <body>
    <noscript>
      <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
    </noscript>
    <div id="app"></div>
    <!-- built files will be auto injected -->
  </body>
</html>

组件里的helloworld.vue

<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
    <p>
      For a guide and recipes on how to configure / customize this project,<br>
      check out the
      <a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
    </p>
    <h3>Installed CLI Plugins</h3>
    <ul>
      <li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
      <li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
    </ul>
    <h3>Essential Links</h3>
    <ul>
      <li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
      <li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
      <li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
      <li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
      <li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
    </ul>
    <h3>Ecosystem</h3>
    <ul>
      <li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
      <li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
      <li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
      <li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
      <li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'HelloWorld',
  props: {
    msg: String
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<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>

根目录下的
app.vue

<template>
  <img alt="Vue logo" src="./assets/logo.png">
  <HelloWorld msg="Welcome to Your Vue.js App"/>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'

export default {
  name: 'App',
  components: {
    HelloWorld
  }
}
</script>

<style>
#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>

src下的main.js

import { createApp } from 'vue'
import App from './App.vue'

createApp(App).mount('#app')

src文件夹里除了组建,还有asset,里头装pnglogo等。


http://www.niftyadmin.cn/n/958037.html

相关文章

vue 列表 点赞/评论 局部刷新

在遍历数据时 前端手动增加字段用来暂存点赞或刷新的数据 this.list.forEach(element > {if(!element.Praise){ //点赞数量element.Praise {Count:0,Data:[]}}if(!element.Comment){ //评论数量及内容element.Comment {Count:0,Data:[]}} });当接口返回成功信息时再进行…

java实现图片转base64字符串 java实现base64字符串转图片,html网页显示base64图片.css显示base64图片.

// Base64 在CSS中的使用 .box{background-image: url("https://img-blog.csdnimg.cn/2022010700223148578.jpg"); } // Base64 在HTML中的使用 <img src"https://img-blog.csdnimg.cn/2022010700223148578.jpg" />经过Base64 编码后的文件体积一般比…

SpringBoot优雅的实现图片返回

注意: response.setContentType("image/png");这行代码一定要加上 RestController Slf4j Api(tags SwaggerConfig.TAG_IMAGE) RequestMapping(SwaggerConfig.TAG_IMAGE) public class ImageController {Resourceprivate HttpServletResponse response;GetMapping(v…

移动端在线预览pdf,word资源

问题1&#xff1a;https网页不支持嵌入另一站点上传的http资源 报错&#xff1a;Mixed Content: The page at ‘https://xxx.html’ was loaded over HTTPS, but requested an insecure resource ‘http://xxx.pdf’. This request has been blocked; the content must be serv…

之前运行成功的66、55等文件,是vue和css、html代码都在一个html文件夹中排列而运行成功的

现在要在三个下排列&#xff0c;就不会了。 官方文档下的这个到底怎么排啊&#xff1f; 只排到一个文档中吗&#xff1f; 不会 那就先试一下把所有的排在一个html文件中吧&#xff0c;看能不能运行出来 他为啥要给这个格式&#xff0c;也不给个运行的图片截图图示。

微信H5页面图片无法显示问题

给img增加父级标签包裹&#xff0c;样式写在父级 **显示有问题写法** <div><img :src"${item.path}" alt"" class"detailCover"> </div>.detailCover{width: 3.6rem;height: 5.04rem;border-radius: .1rem; }**解决写法** &l…

Could not find acceptable representation原因及解决方法

服务器不能联通外部接口了... 用 curl http://www.***.com 试试.如果不通...想办法弄通就好了.

html2cavans 插件

vue移动端微信公众号项目应用html2cavans插件实现将html内容转为图片并保存到相册&#xff08;实测兼容安卓&#xff0c;ios&#xff09; 问题1&#xff1a;安卓端可生成图片&#xff0c;ios端系统在13版本以下的生成失败 解决 &#xff1a;修改npm html2cavans的版本 先移除之…