-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # htdocs/styleguide/category/Block/index.html # htdocs/styleguide/category/Button/index.html # htdocs/styleguide/category/Form/index.html # htdocs/styleguide/category/Global/index.html # htdocs/styleguide/category/Heading/index.html # htdocs/styleguide/category/Icon/index.html # htdocs/styleguide/category/Image/index.html # htdocs/styleguide/category/InteractiveComponent/index.html # htdocs/styleguide/category/Layout/index.html # htdocs/styleguide/category/Link/index.html # htdocs/styleguide/category/List/index.html # htdocs/styleguide/category/Navigation/index.html # htdocs/styleguide/category/Text/index.html # htdocs/styleguide/category/ThirdPartyComponent/index.html # htdocs/styleguide/color.html # htdocs/styleguide/index.html # htdocs/styleguide/namespace/l-/index.html # htdocs/styleguide/namespace/st-/index.html # htdocs/styleguide/namespace/sw-/index.html # htdocs/styleguide/namespace/test-/index.html # htdocs/styleguide/namespace/wisywig-/index.html # package-lock.json
- Loading branch information
Showing
53 changed files
with
9,413 additions
and
1,500 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Component | ||
Vue.jsの単一ファイルコンポーネント(SFC)をコンポーネントと定義します。 | ||
SFCはview(UI)とviewModel(ロジック)、そして装飾を1つのファイルで持つことができるからです。 | ||
|
||
## ディレクトリ構成 | ||
大きく2つにわけられます。 | ||
|
||
1. components.js | ||
2. /componentName | ||
|
||
### components.js | ||
site.jsにインポートするため、コンポーネントを`function`としてエクスポートします。 | ||
|
||
### /componentName | ||
コンポーネント名ごとにディレクトリを作ります。 | ||
命名規則は[Vue.jsのスタイルガイド](https://jp.vuejs.org/v2/style-guide/index.html)を基準とします。 | ||
|
||
`props`を受け取るだけのviewコンポーネント単体の場合は、viewコンポーネントがディレクトリ名になります。 | ||
|
||
``` | ||
components | ||
└── VButton | ||
└── VButton.vue | ||
``` | ||
|
||
`emit`を受け取るviewModelコンポーネントとviewコンポーネントがある場合は、viewModelコンポーネントがディレクトリ名になります。 | ||
|
||
``` | ||
components | ||
└── TheHeader | ||
├── TheHeader.vue | ||
├── TheHeaderLogo.vue | ||
├── TheHeaderNav.vue | ||
└── TheHeaderSearch.vue | ||
``` | ||
|
||
## 中規模以上のディレクトリ構成 | ||
一定以上の規模の場合や、viewコンポーネントを再利用していろいろなViewModelコンポーネントを作りたい場合は、[large-scale-javascriptの分類](https://github.com/azu/large-scale-javascript/blob/master/docs/component.md#%E5%88%86%E9%A1%9E)を参考にしてください。 | ||
`/componentName`がprojectになり、containerとui-kitが追加されるイメージです。 | ||
|
||
``` | ||
components | ||
├── container | ||
│ └── index | ||
│ └── index.vue | ||
├── project | ||
│ └── TheHeader | ||
│ ├── TheHeader.vue | ||
│ ├── TheHeaderLogo.vue | ||
│ ├── TheHeaderNav.vue | ||
│ └── TheHeaderSearch.vue | ||
└── ui | ||
└── VButton | ||
└── VButton.vue | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.