Skip to content

Commit 87567f4

Browse files
committed
upgrade to 2.0
1 parent 846e77d commit 87567f4

4 files changed

Lines changed: 7 additions & 28 deletions

File tree

web-ssr/components/MenuBar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Router from 'next/router'
33
import { TabBar, Icon } from 'antd-mobile'
44

55
export default class MenuBar extends Component {
6-
render () {
6+
render() {
77
const {
88
pathname,
99
children

web-ssr/next.config.js

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,7 @@
11
const path = require('path')
22
const fs = require('fs')
3-
const requireHacker = require('require-hacker')
43

5-
function setupRequireHacker () {
6-
const webjs = '.web.js'
7-
const webModules = ['antd-mobile', 'rmc-picker'].map(m => path.join('node_modules', m))
8-
9-
requireHacker.hook('js', filename => {
10-
if (filename.endsWith(webjs) || webModules.every(p => !filename.includes(p))) return
11-
12-
const webFilename = filename.replace(/\.js$/, webjs)
13-
if (!fs.existsSync(webFilename)) return
14-
15-
return fs.readFileSync(webFilename, { encoding: 'utf8' })
16-
})
17-
18-
requireHacker.hook('svg', filename => {
19-
return requireHacker.to_javascript_module_source(`#${path.parse(filename).name}`)
20-
})
21-
}
22-
23-
setupRequireHacker()
24-
25-
function moduleDir (m) {
4+
function moduleDir(m) {
265
return path.dirname(require.resolve(`${m}/package.json`))
276
}
287

web-ssr/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "with-antd-mobile",
33
"version": "1.1.0",
44
"dependencies": {
5-
"antd-mobile": "1.4.0",
5+
"antd-mobile": "^2.0.0-beta.2",
66
"babel-plugin-import": "^1.2.1",
77
"next": "latest",
88
"react": "^15.6.1",

web-ssr/pages/_document.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import Document, { Head, Main, NextScript } from 'next/document'
22

33
export default class extends Document {
4-
render () {
4+
render() {
55
return (
66
<html>
77
<Head>
8-
<script src='/static/hd.min.js' />
9-
<link rel='stylesheet' type='text/css' href='//unpkg.com/antd-mobile/dist/antd-mobile.min.css' />
8+
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1" />
9+
<link rel='stylesheet' type='text/css' href='//unpkg.com/antd-mobile@2.0.0-beta.2/dist/antd-mobile.min.css' />
1010
</Head>
11-
<body style={{margin: 0}}>
11+
<body style={{ margin: 0 }}>
1212
<Main />
1313
<NextScript />
1414
</body>

0 commit comments

Comments
 (0)