1、package.json
{
"name": "xxx",
"version": "1.0.0",
"description": "a weex project",
"main": "index.js",
"scripts": {
"build": "weex-builder src dist",
"build_plugin": "webpack --config ./tools/webpack.config.plugin.js --color",
"dev": "weex-builder src dist -w",
"serve": "serve -p 8080"
},
"keywords": [
"weex"
],
"author": "fkysly@gmail.com",
"license": "MIT",
"devDependencies": {
"babel-core": "^6.14.0",
"babel-loader": "^6.2.5",
"babel-preset-es2015": "^6.18.0",
"vue-loader": "^10.0.2",
"eslint": "^3.5.0",
"serve": "^1.4.0",
"webpack": "^1.13.2",
"weex-vue-render": "latest",
"weex-loader": "^0.3.3",
"weex-builder": "^0.2.6"
},
"dependencies": {
"weex-html5": "^0.3.2",
"weex-components": "*"
},
"optionalDependencies": {
"ios-deploy": "^1.9.0"
}
}
web/index.html默认没改
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Weex HTML5</title>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="apple-touch-fullscreen" content="yes" />
<meta name="format-detection" content="telephone=no, email=no" />
<style>
html, body, #weex {
width: 100%;
height: 100%;
}
</style>
<script src="../node_modules/weex-html5/dist/weex.js"></script>
</head>
<body>
<div id="weex"></div>
<script src="./index.js"></script>
</body>
</html>
src/index.vue
<template>
<div class="wrapper">
<text>text</text>
</div>
</template>
<script>
var navigator = weex.requireModule('navigator')
var modal = weex.requireModule('modal')
</script>
npm run build
npm run serve
打开http://localhost:8080/web/ind...
控制台报错
Uncaught TypeError: weex.requireModule is not a function
at Object.module.exports.calcTotal.sum (eval at init (http://localhost:8080/node_modules/weex-html5/dist/weex.js:3099:15), <anonymous>:136:23)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…