개발자도구에 뜬 아래 경고의 정체를 알아보자.
vue.runtime.esm.js:623 [Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build. (found in <Root>)
템플릿을 실시간으로 컴파일해야 하는 경우 ->
template
옵션에 스트링을 넘기는 식으로 하거나 in-DOM HTML을 사용하여 element에 마운트하는 경우는 컴파일러와 전체 빌드가 필요하다.
// this requires the compiler
new Vue({
template: '<div>{{ hi }}</div>'
})
// this does not
new Vue({
render (h) {
return h('div', this.hi)
}
})
vue-loader
를 쓰거나, vueify
를 사용하면, *.vue 파일에 있는 템플릿은 빌드타임에 JS로 미리 컴파일된다. 따라서, 마지막 번들에서는 컴파일이 필요없게 된다.
런타임 빌드는 full-build보다 30프로정도 가벼우니, 이 방법을 사용해야 한다.
// src/index.js
import Vue from 'vue';
import AppComponent from './components/AppComponent.vue';
// root element
new Vue({
el: '#app',
components: {
AppComponent
}
});
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing