Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

docs: fix App data 的声明的错误和重复的片段 #165

Merged
merged 2 commits into from
Aug 27, 2019
Merged
Changes from 1 commit
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
26 changes: 5 additions & 21 deletions docs/advanced-guide/sharing-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ order: 43
```js
// app.js

export default class App {
data: {
name: 'remax'
export default class App {
construction () {
this.data = {
name: 'remax'
}
Darmody marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand All @@ -34,24 +36,6 @@ export default () => {
return <View onClick={gotoB}>goto B</View>;
}

// pages/A/index.js

import { navigateTo, View } from 'remax/wechat';

const app = getApp();

export default () => {
const gotoB = () => {
app.data.name = 'B';

navigateTo({
url: 'pages/B/index'
})
}

return <View onClick={gotoB}>goto B</View>;
}

// pages/B/index.js
import { View } from 'remax/wechat';

Expand Down