Skip to content

Commit 11db521

Browse files
committed
U
1 parent 4935f2e commit 11db521

File tree

13 files changed

+220
-4
lines changed

13 files changed

+220
-4
lines changed

my-project/build/webpack.base.conf.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ module.exports = {
1414
shopping_cart: './src/vuex-demo/shopping-cart/app.js', // shopping_cart
1515
todomvc: './src/vuex-demo/todomvc/app.js', // todomvc
1616
mint_ui1: './src/vuex-demo/mint_ui1.js', // mint_ui1.js
17-
treeview: './src/vuejs2-demo/treeview/app.js' // treeview.js
17+
treeview: './src/vuejs2-demo/treeview/app.js', // treeview.js
18+
iscomponent:'./src/vuejs2-demo/is-component/main.js' // iscomponent
1819
},
1920
output: {
2021
path: config.build.assetsRoot,

my-project/build/webpack.dev.conf.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,14 @@ module.exports = merge(baseWebpackConfig, {
106106
chunks: ['treeview'], //需要引入的chunk,不配置就会引入所有页面的资源
107107
}),
108108
// --------多頁 end
109-
109+
// --------多頁 start
110+
new HtmlWebpackPlugin({
111+
filename: 'iscomponent.html',
112+
template: 'src/vuejs2-demo/is-component/index.html',
113+
inject: true,
114+
chunks: ['iscomponent'], //需要引入的chunk,不配置就会引入所有页面的资源
115+
}),
116+
// --------多頁 end
110117

111118
]
112119
})

my-project/build/webpack.prod.conf.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,20 @@ var webpackConfig = merge(baseWebpackConfig, {
210210
chunksSortMode: 'dependency'
211211
}),
212212
//----------多页 end
213-
//
213+
//----------多页 start
214+
new HtmlWebpackPlugin({
215+
filename: '../dist/iscomponent.html',
216+
template: 'src/vuejs2-demo/is-component/index.html',
217+
inject: true,
218+
minify: {
219+
removeComments: true,
220+
collapseWhitespace: true,
221+
removeAttributeQuotes: true
222+
},
223+
chunks: ['manifest', 'vendor', 'iscomponent'], //需要引入的chunk,不配置就会引入所有页面的资源
224+
chunksSortMode: 'dependency'
225+
}),
226+
//----------多页 end
214227
//
215228
//
216229

my-project/src/App.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
</ul>
2525
<h3>第03章:vue.js 2 示例区</h3>
2626
<ul>
27-
<li><a href='treeview.html'>Tree View for Vue-Cli </a></li>
27+
<li><a href='treeview.html'>Tree View 递归组件 示例 </a></li>
28+
<li><a href='iscomponent.html'>动态组件 使用 is 示例 </a></li>
2829
</ul>
2930
</div>
3031
</div>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<template>
2+
<div>
3+
<h3>is 动态组件</h3>
4+
<home></home>
5+
</div>
6+
7+
</template>
8+
9+
<script>
10+
import home from './view/Home.vue'
11+
export default {
12+
data(){
13+
return {
14+
path: ''
15+
}
16+
},
17+
components: {
18+
home
19+
},
20+
methods:{
21+
22+
}
23+
}
24+
</script>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<template>
2+
<div>
3+
123
4+
</div>
5+
</template>
6+
<script>
7+
export default {
8+
data () {
9+
return {
10+
msg: 'Welcome to Your Vue.js App'
11+
}
12+
}
13+
}
14+
</script>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<template>
2+
<div>
3+
456
4+
</div>
5+
</template>
6+
<script>
7+
export default {
8+
data () {
9+
return {
10+
msg: 'Welcome to Your Vue.js App'
11+
}
12+
}
13+
}
14+
</script>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<template>
2+
<div v-bind:style="{ top: calsss}">
3+
789
4+
</div>
5+
</template>
6+
<script>
7+
export default {
8+
props: ['calsss'],
9+
data () {
10+
return {
11+
msg: 'Welcome to Your Vue.js App'
12+
}
13+
}
14+
}
15+
</script>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<template>
2+
<footer class="page">
3+
foter
4+
</footer>
5+
</template>
6+
<script>
7+
export default{
8+
data(){
9+
return {
10+
11+
}
12+
},
13+
props: {
14+
isSelect: {
15+
type: String,
16+
},
17+
},
18+
methods: {
19+
barSelect(flag){
20+
this.$router.push({path: flag});
21+
},
22+
}
23+
}
24+
25+
26+
</script>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<header class="header">
3+
<a style="color:white">{{dataNumber}}</a>
4+
</header>
5+
</template>
6+
<script>
7+
export default {
8+
props: {
9+
dataNumber: {
10+
type: Number,
11+
},
12+
},
13+
data () {
14+
return {
15+
msg: 'Welcome to Your Vue.js App'
16+
}
17+
}
18+
}
19+
</script>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Tree View</title>
6+
</head>
7+
<body>
8+
<div id="app"></div>
9+
10+
</body>
11+
</html>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
import Vue from 'vue'
3+
import App from './App.vue'
4+
5+
new Vue({
6+
el: '#app',
7+
render: h => h(App)
8+
})
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<template>
2+
<div>
3+
4+
<div style="margin-top:60px">
5+
<component v-bind:is="currentView1"></component>
6+
<component v-bind:is="currentView2"></component>
7+
<component v-bind:is="currentView3"></component>
8+
</div>
9+
<button v-on:click="methods1()">123</button>
10+
<button v-on:click="methods2()">213</button>
11+
<button v-on:click="methods3()">321</button>
12+
13+
</div>
14+
</template>
15+
<script>
16+
17+
import aaa from './../components/a.vue'
18+
import bbb from './../components/b.vue'
19+
import ccc from './../components/c.vue'
20+
export default{
21+
components: {
22+
23+
aaa,
24+
bbb,
25+
ccc
26+
},
27+
data(){
28+
return {
29+
currentView1: 'aaa',
30+
currentView2: 'bbb',
31+
currentView3: 'ccc'
32+
}
33+
},
34+
created(){
35+
//this.init();
36+
},
37+
methods: {
38+
init(){
39+
var _self = this;
40+
},
41+
methods1:function () {
42+
console.log('1')
43+
this.currentView1= 'aaa'
44+
this.currentView2= 'bbb'
45+
this.currentView3= 'ccc'
46+
},
47+
methods2:function () {
48+
console.log('2')
49+
this.currentView1= 'bbb'
50+
this.currentView2= 'ccc'
51+
this.currentView3= 'aaa'
52+
},
53+
methods3:function () {
54+
console.log('3')
55+
this.currentView1= 'ccc'
56+
this.currentView2= 'bbb'
57+
this.currentView3= 'aaa'
58+
},
59+
},
60+
computed: {
61+
}
62+
}
63+
</script>

0 commit comments

Comments
 (0)