LoginSignup
1
0

More than 3 years have passed since last update.

vue cliでプロジェクト作ったら(メモ)

Last updated at Posted at 2019-05-03

前記事のURL

プロジェクトのディレクトリで「run npm serve」

npmrundev.jpg

localhost:8080にアクセス

runserve.jpg

デフォルトのプロジェクトができます

default.jpg

デフォルトをいじる Part1~HelloWorld.vueのリネーム~

まずcomponentsのHelloWorld.vueをリネームしましょう(ダサいから)
helloworld.jpg

安心してください。ページが死ぬだけです。
compile.jpg

App.vueにHelloWorldがいっぱいいるので、全部indexに変えましょう。
changealloccurences.jpg

App.vue
<template>
  <div id="app">
    <img alt="Vue logo" src="./assets/logo.png">
    <index msg="Welcome to Your Vue.js App"/>
  </div>
</template>

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

export default {
  name: 'app',
  components: {
    index
  }
}
</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>

デフォルトをいじる Part2~ページをまっさらに~

つづいて、こいつを真っ白に染めましょう
default.jpg

divタグとstyleタグの中を消しましょう。

App.vue
<template>
  <div id="app">
   <h1>vue cliがまっさらに・・・</h1>
  </div>
</template>

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

export default {
  name: 'app',
  components: {
    index
  }
}
</script>

<style>

</style>

index.vueの中も同様にですね。※divタグのクラスはご自由に

index.vue

<template>
  <div class="index container">

  </div>
</template>

<script>
export default {
  name: 'index',
  props: {

  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style>

</style>

white.jpg

つづく

次回はcomponentの追加における3ステップについて!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0