Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix mpvue 未找到入口 app.json 文件 #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9,438 changes: 9,438 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"html-webpack-plugin": "^3.2.0",
"http-proxy-middleware": "^0.18.0",
"mpvue-entry": "^0.3.6",
"mpvue-loader": "^1.0.12",
"mpvue-loader": "1.0.12",
"mpvue-template-compiler": "^1.0.9",
"mpvue-webpack-target": "^1.0.0",
"optimize-css-assets-webpack-plugin": "^3.2.0",
Expand Down
4 changes: 2 additions & 2 deletions project.config.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"description": "项目配置文件。",
"setting": {
"urlCheck": true,
"urlCheck": false,
"es6": false,
"postcss": true,
"minified": true,
"newFeature": true
},
"miniprogramRoot": "./dist/",
"compileType": "miniprogram",
"appid": "touristappid",
"appid": "wxea12c7d484e1eb74",
"projectname": "mpvue-demo",
"condition": {
"search": {
Expand Down
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ app.$mount()

export default {
config: {
pages: ['^pages/index'],
pages: ['^pages/index', 'pages/test'],
window: {
backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#fff',
Expand Down
6 changes: 6 additions & 0 deletions src/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@ module.exports = [
config: {
navigationBarTitleText: '小程序官方组件展示'
}
},
{
path: '/pages/test',
config: {
navigationBarTitleText: 'test'
}
}
]
14 changes: 14 additions & 0 deletions src/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
<template>
<div class="container">
<h2 class="title">hello mpvue</h2>
<button @click="gotoPage1"> page1 </button>
<button @click="gotoPage2"> page2 </button>
</div>
</template>

<script>
export default {
methods: {
gotoPage1 () {
wx.navigateTo({
url: '/pages/test?id=1'
})
},
gotoPage2 () {
wx.navigateTo({
url: '/pages/test?id=2'
})
}
}
}
</script>

Expand Down
79 changes: 79 additions & 0 deletions src/pages/test.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<template>
<div class="container">
<h2 class="title">ID:{{id}}</h2>
<button @click="gotoPage1"> page1 </button>
<button @click="gotoPage2"> page2 </button>
</div>
</template>

<script>
export default {
data () {
return {
id: 0
}
},
onLoad () {
console.log('pages/test onLoad')
let id = this.$root.$mp.query.id
console.log('query', this.$root.$root.$mp.query)
this.id = id
},
onShow () {
console.log('pages/test onShow', this.id)
},
onHide () {
console.log('pages/test onHide', this.id)
},
onUnload () {
console.log('pages/test onUnload', this.id)
},
onReady () {
console.log('pages/test onReady', this.id)
},
beforeCreated () {
console.log('pages/test beforeCreated', this.id)
},
created () {
console.log('pages/test created', this.id)
},
beforeMount () {
console.log('pages/test beforeMount', this.id)
},
mounted () {
console.log('pages/test mounted', this.id)
},
beforeUpdate () {
console.log('pages/test beforeUpdate', this.id)
},
updated () {
console.log('pages/test updated', this.id)
},
beforeDestroy () {
console.log('pages/test beforeDestroy', this.id)
},
destroyed () {
console.log('pages/test destroyed', this.id)
},

methods: {
gotoPage1 () {
wx.navigateTo({
url: '/pages/test?id=1'
})
},
gotoPage2 () {
wx.navigateTo({
url: '/pages/test?id=2'
})
}
}
}
</script>

<style>
.title {
padding-top: 200px;
text-align: center;
}
</style>
23 changes: 23 additions & 0 deletions wiki/life-cycle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
page 1
page 2
back to page 1

pages/test created 0
test.vue:17 pages/test onLoad
test.vue:19 query {id: "1"}
test.vue:23 pages/test onShow 1
test.vue:32 pages/test onReady 1
test.vue:41 pages/test beforeMount 1
test.vue:44 pages/test mounted 1
test.vue:26 pages/test onHide 1
test.vue:17 pages/test onLoad
test.vue:19 query {id: "2"}
test.vue:23 pages/test onShow 2
test.vue:47 pages/test beforeUpdate 2
test.vue:50 pages/test updated 2
test.vue:32 pages/test onReady 2
test.vue:41 pages/test beforeMount 2
test.vue:47 pages/test beforeUpdate 2
test.vue:44 pages/test mounted 2
test.vue:29 pages/test onUnload 2
test.vue:23 pages/test onShow 2