Skip to content

Commit b10b136

Browse files
author
zanjs
committed
🐶 init
0 parents  commit b10b136

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+33590
-0
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
dist
2+
node_modules
3+
bower_components
4+
.idea
5+
*.swp
6+
.DS_Store
7+
.DS_Store?

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
##vue+gulp+webpack 单页面组件开发
2+
######网络问题 开发保留了node_modules文件夹
3+
-----------------------------------
4+
5+
##node环境
6+
7+
browser-sync
8+
webpack
9+
gulp
10+
11+
12+
##开发命令
13+
14+
gulp
15+
16+
3
17+
##源码分析命令
18+
19+
gulp vue

develop/components/header/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
require('./style.styl')
2+
3+
module.exports = {
4+
template: require('./template.html'),
5+
props: ['msg']
6+
}

develop/components/header/style.styl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
app-header
2+
color #bada55
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<h1>{{msg}}</h1>

develop/components/pane/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require('./style.styl')
2+
3+
module.exports = {
4+
template: require('./template.html'),
5+
replace: true,
6+
props: ['side', 'name']
7+
}

develop/components/pane/style.styl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.pane
2+
display inline-block
3+
width 300px
4+
height 300px
5+
box-sizing border-box
6+
padding 15px 30px
7+
border 2px solid #f3f3f3
8+
margin 10px

develop/components/pane/template.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<div class="pane">
2+
<p>This is the {{side}} pane!</p>
3+
<p>{{name}}</p>
4+
</div>

develop/main.js

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// With proper loader configuration you can load,
2+
// pre-process and insert css directly with require().
3+
// See webpack.config.js for details.
4+
require('./main.styl')
5+
6+
var Vue = require('vue');
7+
8+
var a = Vue.component('user-profile', {
9+
template: '<li {{view}}>{{user.name}} {{user.email}} {{user.msg}} {{parents}}</li>',
10+
props: ['parents'],
11+
data: function() {
12+
return {
13+
msg: '我的测试'
14+
}
15+
},
16+
17+
computed: {
18+
msg: {
19+
set: function() {
20+
alert(2)
21+
},
22+
get: function() {
23+
alert(1)
24+
}
25+
}
26+
},
27+
28+
compiled: function() {
29+
this.$log(this)
30+
},
31+
created: function() {
32+
this.$dispatch('child-created', this)
33+
}
34+
})
35+
36+
37+
var app = new Vue({
38+
el: '#app',
39+
data: {
40+
view: 'page-a',
41+
users: [{
42+
name: 'Chuck Norris',
43+
44+
}, {
45+
name: 'Bruce Lee',
46+
47+
}, {
48+
name: 'Bruce Lee',
49+
50+
}, {
51+
name: '111e',
52+
email: '12312312312'
53+
}],
54+
parents: 'Aaron'
55+
},
56+
57+
created: function() {
58+
this.$on('child-created', function(child) {
59+
// console.log(child)
60+
})
61+
},
62+
63+
components: {
64+
// define the main pages as async components.
65+
'page-a': function(resolve) {
66+
require(['./views/a'], resolve)
67+
},
68+
'page-b': function(resolve) {
69+
require(['./views/b'], resolve)
70+
}
71+
}
72+
})
73+
74+
75+
console.log(app)
76+
77+
78+
/**
79+
* Some really crude routing logic here, just for
80+
* demonstration purposes. The key thing to note here is
81+
* that we are simply changing the view of the root app -
82+
* Vue's async components and Webpack's code splitting will
83+
* automatically handle all the lazy loading for us.
84+
*/
85+
86+
function route() {
87+
app.view = window.location.hash.slice(1) || 'page-a'
88+
}
89+
90+
window.addEventListener('hashchange', route)
91+
window.addEventListener('load', route)

develop/main.styl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
html, body
2+
font-family Helvetica, Arial, sans-serif
3+
4+

0 commit comments

Comments
 (0)