File tree Expand file tree Collapse file tree 7 files changed +99
-27
lines changed Expand file tree Collapse file tree 7 files changed +99
-27
lines changed Original file line number Diff line number Diff line change 1
1
<!DOCTYPE html>
2
2
< html lang ="en ">
3
- < head >
4
- < meta charset ="utf-8 ">
5
- < meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
6
- < meta name ="viewport " content ="width=device-width,initial-scale=1.0 ">
7
- < link rel ="icon " href ="<%= BASE_URL %>favicon.ico ">
8
- < title > vue-demo</ title >
9
- </ head >
10
- < body >
11
- < noscript >
12
- < strong > We're sorry but vue-demo doesn't work properly without JavaScript enabled. Please enable it to continue.</ strong >
13
- </ noscript >
14
- < div id ="app "> </ div >
15
- <!-- built files will be auto injected -->
16
- </ body >
17
- </ html >
3
+
4
+ < head >
5
+ < meta charset ="utf-8 ">
6
+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
7
+ < meta name ="viewport " content ="width=device-width,initial-scale=1.0 ">
8
+ < link rel ="icon " href ="<%= BASE_URL %>favicon.ico ">
9
+ < title > vue-demo</ title >
10
+ </ head >
11
+
12
+ < body >
13
+ < noscript >
14
+ < strong > We're sorry but vue-demo doesn't work properly without JavaScript enabled. Please enable it to continue.</ strong >
15
+ </ noscript >
16
+ < div id ="app "> </ div >
17
+ <!-- <div id="app-test">
18
+ <blog-post post-title="这条不生效哦"></blog-post>
19
+ </div> -->
20
+ <!-- built files will be auto injected -->
21
+ </ body >
22
+
23
+ </ html >
Original file line number Diff line number Diff line change 172
172
输入传入组件内容: <input type =" text" v-model =" notLazyText" >
173
173
<global-component v-model =" notLazyText" ></global-component >
174
174
175
-
175
+ <hr >
176
+ <h3 >全局、局部组件注册&require.context多表单全局注册</h3 >
177
+ <base-1 ></base-1 >  ;  ;
176
178
<base-2 ></base-2 >
177
179
180
+ <hr >
181
+ <h3 >prop大小写问题</h3 >
182
+ <blog-post postTitle =" 这条不生效哦" ></blog-post > “”放到模板index.html文件中不生效“”
183
+ <blog-post post-title =" hello!" ></blog-post >
184
+
185
+ <hr >
186
+ <h3 >prop验证</h3 >
187
+ <!-- <prop-rules :propA="123" propB="this is a string" propC="this is required" propD="this have default string" :propE="{name: '糖少'}" propF="'other' is not in arr, so there is a eroor message here"></prop-rules> -->
188
+ <prop-rules :propA =" 123" propB =" this is a string" propC =" this is required" propD =" this have default string" :propE =" {name: '糖少'}" propF =" danger" ></prop-rules >
178
189
179
190
180
191
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div >
3
+ <h4 >单个类型传递: {{propA}}</h4 >
4
+ <h4 >多个类型传递: {{propB}}</h4 >
5
+ <h4 >必填字段: {{propC}}</h4 >
6
+ <h4 >带默认值字段: {{propD}}</h4 >
7
+ <h4 >带默认值的对象和数组(必须从一个工厂函数中获取): {{JSON.stringify(propE)}}</h4 >
8
+ <h4 >自定义验证函数: {{propF}}</h4 >
9
+
10
+ </div >
11
+ </template >
12
+ <style >
13
+ h4 {
14
+ background : skyblue ;
15
+ }
16
+ </style >
17
+
18
+ <script >
19
+ export default {
20
+ props: {
21
+ propA: Number ,
22
+ propB: [String , Number ],
23
+ propC: {
24
+ type: String ,
25
+ required: true
26
+ },
27
+ propD: {
28
+ type: String ,
29
+ default: ' hello world'
30
+ },
31
+ propE: {
32
+ type: Object ,
33
+ default : function () {
34
+ return {message: " hello , i'm a object " }
35
+ }
36
+ },
37
+ propF: {
38
+ validator : function (val ) {
39
+ return [' success' , ' warning' , ' danger' ].indexOf (val) !== - 1
40
+ }
41
+ }
42
+ },
43
+ data () {
44
+ return {
45
+
46
+ }
47
+ }
48
+ }
49
+ </script >
50
+
Original file line number Diff line number Diff line change @@ -9,4 +9,10 @@ export default {
9
9
}
10
10
}
11
11
}
12
+
13
+ // export const render = function(c) {
14
+ // return c('el-tag',{
15
+ // type:'info'
16
+ // },['标签一'])
17
+ // }
12
18
</script >
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -6,12 +6,17 @@ import upperFirst from 'lodash/upperFirst'
6
6
import camelCase from 'lodash/camelCase'
7
7
import GlobalComponent from '@/components/GlobalComponent'
8
8
import TodoItem from '@/components/TodoItem'
9
+ import PropRules from '@/components/PropRules'
9
10
Vue . use ( ElementUI )
10
11
Vue . config . productionTip = false
11
12
12
13
Vue . component ( 'GlobalComponent' , GlobalComponent )
13
14
Vue . component ( 'TodoItem' , TodoItem )
14
-
15
+ Vue . component ( 'blog-post' , {
16
+ props : [ 'postTitle' ] ,
17
+ template : '<h3>{{ postTitle }}</h3>'
18
+ } )
19
+ Vue . component ( 'prop-rules' , PropRules )
15
20
const requireComponent = require . context (
16
21
'./components/tempComponents' ,
17
22
false ,
@@ -31,3 +36,5 @@ requireComponent.keys().forEach(fileName => {
31
36
new Vue ( {
32
37
render : h => h ( App ) ,
33
38
} ) . $mount ( '#app' )
39
+
40
+ // new Vue().$mount('#app-test')
Original file line number Diff line number Diff line change 1
1
module . exports = {
2
2
devServer : {
3
3
open : true
4
- }
4
+ } ,
5
+ runtimeCompiler : true
5
6
}
You can’t perform that action at this time.
0 commit comments