Skip to content

Commit 88140a6

Browse files
committed
update
1 parent e6c2c67 commit 88140a6

16 files changed

+334
-0
lines changed

Weex学习/weexStudy/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
node_modules/
3+
dist/
4+
platforms/
5+
npm-debug.log
6+
selenium-debug.log
7+
test/unit/coverage
8+
test/e2e/reports

Weex学习/weexStudy/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"AppName":"WeexApp",
3+
"AppId":"com.alibaba.weex",
4+
"SplashText":"Hello\nWeex",
5+
"WeexBundle":"index.js"
6+
}

Weex学习/weexStudy/config.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<widget id="com.alibaba.weex" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
3+
<name>MyApp1</name>
4+
<description>
5+
A sample Apache Cordova application that responds to the deviceready event.
6+
</description>
7+
<author email="dev@cordova.apache.org" href="http://cordova.io">
8+
Apache Cordova Team
9+
</author>
10+
<content src="index.html" />
11+
<plugin name="cordova-plugin-whitelist" spec="1" />
12+
<access origin="*" />
13+
<allow-intent href="http://*/*" />
14+
<allow-intent href="https://*/*" />
15+
<allow-intent href="tel:*" />
16+
<allow-intent href="sms:*" />
17+
<allow-intent href="mailto:*" />
18+
<allow-intent href="geo:*" />
19+
<platform name="android">
20+
<allow-intent href="market:*" />
21+
</platform>
22+
<platform name="ios">
23+
<allow-intent href="itms:*" />
24+
<allow-intent href="itms-apps:*" />
25+
</platform>
26+
</widget>

Weex学习/weexStudy/hooks/README.md

Whitespace-only changes.

Weex学习/weexStudy/ios.config.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"AppName":"WeexApp",
3+
"Version":"0.1",
4+
"BuildVersion":"0.1.0",
5+
"AppId":"",
6+
"CodeSign":"",
7+
"Profile":"",
8+
"WeexBundle":"index.js"
9+
}

Weex学习/weexStudy/package.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "xxx",
3+
"version": "1.0.0",
4+
"description": "a weex project",
5+
"main": "index.js",
6+
"scripts": {
7+
"build": "webpack",
8+
"build_plugin": "webpack --config ./tools/webpack.config.plugin.js --color",
9+
"dev": "webpack --watch",
10+
"serve": "serve -p 8080"
11+
},
12+
"keywords": [
13+
"weex"
14+
],
15+
"author": "fkysly@gmail.com",
16+
"license": "MIT",
17+
"devDependencies": {
18+
"babel-core": "^6.14.0",
19+
"babel-loader": "^6.2.5",
20+
"babel-preset-es2015": "^6.18.0",
21+
"vue-loader": "^10.0.2",
22+
"eslint": "^3.5.0",
23+
"serve": "^1.4.0",
24+
"webpack": "^1.13.2",
25+
"weex-loader": "^0.3.3"
26+
},
27+
"dependencies": {
28+
"weex-html5": "^0.3.2",
29+
"weex-components": "*"
30+
},
31+
"optionalDependencies": {
32+
"ios-deploy": "^1.9.0"
33+
}
34+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# use weexpack add plugin
2+
3+
#### add a plugin
4+
5+
``` bash
6+
weexpack plugin add plugin_name
7+
```
8+

Weex学习/weexStudy/src/index.we

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<template>
2+
<div class="container">
3+
<image src="http://ata2-img.cn-hangzhou.img-pub.aliyun-inc.com/7d42775b8f0d0c86589082dc9ee179c2.png" class="bannar-image"/>
4+
<text class="message">{{ message }}</text>
5+
<text class="quotes">{{ quotes }}sfdds</text>
6+
</div>
7+
</template>
8+
9+
<style>
10+
.container{
11+
display: flex;
12+
flex-direction: column;
13+
align-items: center;
14+
}
15+
16+
.bannar-image{
17+
width:200;
18+
height:200;
19+
}
20+
.message{
21+
padding-top: 20;
22+
padding-bottom: 40;
23+
color: #0055dd;
24+
font-size: 28;
25+
}
26+
.quotes{
27+
font-size: 16;
28+
color:#666;
29+
}
30+
</style>
31+
32+
<script>
33+
module.exports = {
34+
data: {
35+
message: 'Welcome to Use Weexpack!',
36+
quotes: 'A Tool To Build WEEX Faster',
37+
}
38+
}
39+
</script>

Weex学习/weexStudy/start

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
echo "*****************************************************************************"
2+
echo "* Welcome to Weex *"
3+
echo "* *"
4+
echo "* A framework for building Mobile cross-platform UI. *"
5+
echo "* *"
6+
echo "* https://github.com/alibaba/weex *"
7+
echo "*****************************************************************************"
8+
9+
10+
THIS_DIR=$(dirname "$0")
11+
pushd "$THIS_DIR"
12+
npm run serve
13+
popd
14+

Weex学习/weexStudy/start.bat

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@echo off
2+
echo "*****************************************************************************"
3+
echo "* Welcome to Weex *"
4+
echo "* *"
5+
echo "* A framework for building Mobile cross-platform UI. *"
6+
echo "* *"
7+
echo "* https://github.com/alibaba/weex *"
8+
echo "*****************************************************************************"
9+
10+
pushd %~dp0
11+
npm run serve
12+
popd
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// only build plugin module
2+
require('webpack')
3+
require('weex-loader')
4+
5+
var path = require('path');
6+
var fs=require('fs');
7+
8+
let root = process.cwd();
9+
10+
module.exports = {
11+
entry: {
12+
plugins: [path.join(root,'plugins/plugin_bundle.js'),path.join(root,'web/js/init.js')],
13+
},
14+
output: {
15+
path: path.join(root,'web'),
16+
filename: 'index.js'
17+
},
18+
devtool:'inline-source-map',
19+
module: {
20+
loaders: [
21+
{
22+
test: /\.js(\?[^?]+)?$/,
23+
exclude: /node_modules/,
24+
loader: 'babel-loader?presets[]=es2015',
25+
},
26+
{
27+
test: /\.we(\?[^?]+)?$/,
28+
loader: 'weex-loader',
29+
},
30+
{
31+
test: /\.vue(\?[^?]+)?$/,
32+
loader: 'vue',
33+
}
34+
]
35+
},
36+
37+
/*plugins: [
38+
new webpack.optimize.UglifyJsPlugin( {
39+
minimize : true,
40+
sourceMap : true,
41+
mangle: true,
42+
compress: {
43+
warnings: false
44+
}
45+
} )
46+
]*/
47+
48+
}

Weex学习/weexStudy/web/index.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Weex HTML5</title>
6+
<meta name="apple-mobile-web-app-capable" content="yes" />
7+
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
8+
<meta name="apple-touch-fullscreen" content="yes" />
9+
<meta name="format-detection" content="telephone=no, email=no" />
10+
<style>
11+
html, body, #weex {
12+
width: 100%;
13+
height: 100%;
14+
}
15+
</style>
16+
<script src="../node_modules/weex-html5/dist/weex.js"></script>
17+
</head>
18+
<body>
19+
<div id="weex"></div>
20+
<script src="./index.js"></script>
21+
</body>
22+
</html>

Weex学习/weexStudy/web/index.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Init weex instance depending on the url params.
3+
* There are three ways to load weex bundles, depends on the
4+
* parameter 'loader' in the url:
5+
*
6+
* + xhr: use XMLHttpRequest. Parameter 'page' should be
7+
* the bundle's url.
8+
* + source: use the transformed code itself. 'page' should
9+
* be the transformed weex bundle.
10+
*
11+
* @param {String} bundle - It has different meaning depends on
12+
* the type of loader.
13+
*/
14+
15+
16+
17+
(function () {
18+
function getUrlParam(key) {
19+
var reg = new RegExp('[?|&]' + key + '=([^&]+)')
20+
var match = location.search.match(reg)
21+
return match && match[1]
22+
}
23+
var loader = getUrlParam('loader') || 'xhr';
24+
var page = getUrlParam('page') || '../dist/index.js';
25+
window.weex.init({
26+
appId: location.href
27+
, loader: loader
28+
, source: page
29+
, rootId: 'weex'
30+
})
31+
})();
32+

Weex学习/weexStudy/web/js/init.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Init weex instance depending on the url params.
3+
* There are three ways to load weex bundles, depends on the
4+
* parameter 'loader' in the url:
5+
*
6+
* + xhr: use XMLHttpRequest. Parameter 'page' should be
7+
* the bundle's url.
8+
* + source: use the transformed code itself. 'page' should
9+
* be the transformed weex bundle.
10+
*
11+
* @param {String} bundle - It has different meaning depends on
12+
* the type of loader.
13+
*/
14+
15+
16+
17+
(function () {
18+
function getUrlParam(key) {
19+
var reg = new RegExp('[?|&]' + key + '=([^&]+)')
20+
var match = location.search.match(reg)
21+
return match && match[1]
22+
}
23+
var loader = getUrlParam('loader') || 'xhr';
24+
var page = getUrlParam('page') || '../dist/index.js';
25+
window.weex.init({
26+
appId: location.href
27+
, loader: loader
28+
, source: page
29+
, rootId: 'weex'
30+
})
31+
})();
32+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
require('webpack');
2+
require('weex-loader');
3+
var path = require('path');
4+
var fs = require('fs');
5+
var entry = {};
6+
7+
function walk(dir, root) {
8+
var directory = path.join(__dirname, root, dir)
9+
fs.readdirSync(directory).forEach(function (file) {
10+
var fullpath = path.join(directory, file)
11+
var stat = fs.statSync(fullpath)
12+
// support for vue file
13+
if (stat.isFile() && (path.extname(fullpath) === '.we' || path.extname(fullpath) === '.vue')) {
14+
var name = path.join(dir, path.basename(file, '.we'))
15+
entry[name] = fullpath + '?entry=true'
16+
}
17+
else if (stat.isDirectory()) {
18+
var subdir = path.join(dir, file)
19+
walk(subdir, root)
20+
}
21+
})
22+
}
23+
walk('./', 'src');
24+
module.exports = {
25+
entry: entry
26+
, output: {
27+
path: 'dist'
28+
, filename: '[name].js'
29+
}
30+
, devtool: 'inline-source-map'
31+
, module: {
32+
loaders: [
33+
{
34+
test: /\.we(\?[^?]+)?$/
35+
, loaders: ['weex-loader']
36+
}
37+
, {
38+
test: /\.vue(\?[^?]+)?$/
39+
, loaders: ['vue']
40+
}
41+
]
42+
}
43+
}

0 commit comments

Comments
 (0)