Skip to content

Commit

Permalink
chore: 1.2 example重新转化
Browse files Browse the repository at this point in the history
  • Loading branch information
ykforerlang committed Aug 12, 2019
1 parent d78763c commit 0ea7942
Show file tree
Hide file tree
Showing 382 changed files with 2,995 additions and 3,214 deletions.
41 changes: 35 additions & 6 deletions examples/HelloWorldExpoWP/commonwxs.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,42 @@ var DEFAULTCONTAINERSTYLE =


var getFinalStyle = function (d) {
return d.replace('_1_', DEFAULTVIEWSTYLE)
.replace('_2_', DEFAULTTEXTWSTYLE)
.replace('_3_', DEFAULTINNERTEXTWSTYLE)
.replace('_4_', DEFAULTSCROLLVIEWSTYLE)
.replace('_5_', DEFAULTCONTAINERSTYLE)
if (!d) return ''

if (d === '_5_') return DEFAULTCONTAINERSTYLE

if (d.charAt(0) !== '_') {
return d
}


if (d.charAt(1) === '1') {
return d.replace('_1_', DEFAULTVIEWSTYLE)
}

if (d.charAt(1) === '2') {
return d.replace('_2_', DEFAULTTEXTWSTYLE)
}

if (d.charAt(1) === '3') {
return d.replace('_3_', DEFAULTINNERTEXTWSTYLE)
}

if (d.charAt(1) === '4') {
return d.replace('_4_', DEFAULTSCROLLVIEWSTYLE)
}
}

var lite = function(v) {
return v.constructor === 'Number' || v.constructor === 'String'
}


module.exports = {
getFinalStyle: getFinalStyle
getFinalStyle: getFinalStyle,
lite: lite,


s: getFinalStyle,
l: lite,
};
64 changes: 64 additions & 0 deletions examples/HelloWorldExpoWP/compCommon.wxss
Original file line number Diff line number Diff line change
@@ -1,3 +1,67 @@
.view {
display: flex;
flex-grow: 0;
flex-shrink: 0;
position: relative;
flex-direction: column;
box-sizing: border-box;
border-width: 0;
border-style: solid;
min-width: 0;
min-height: 0;
}

.text {
display: inline-block;
flex-grow: 0;
flex-shrink: 0;
overflow: hidden;
position: relative;
flex-direction: column;
box-sizing: border-box ;
border-width: 0;
border-style: solid;
min-width: 0;
min-height: 0;
}

.textInner {
display: inline;
min-width: 0;
min-height: 0;
}

.scroll {
display: flex;
position: relative;
flex-direction: column;
box-sizing: border-box;
flex: 1 ;
border-width: 0;
border-style: solid;
min-width: 0;
min-height: 0;
}

.container {
display: flex;
flex: 1;
flex-basis: 100%;
width: 100%;
height: 100%;
justify-content: inherit;
align-items: inherit;
flex-wrap: inherit;
box-sizing: border-box;
border:none;
flex-direction: inherit;
border-radius: inherit;
position: static;
min-width: 0;
min-height: 0;
}


/*TouchableOpacity TouchableHighlight 使用*/
.thFabricate {
display: none;
Expand Down
2 changes: 1 addition & 1 deletion examples/HelloWorldExpoWP/project.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"nodeModules": true
},
"compileType": "miniprogram",
"libVersion": "2.4.4",
"libVersion": "2.7.7",
"appid": "wx67a52214b440b81b",
"projectname": "HelloWorldExpoWP",
"isGameTourist": false,
Expand Down
5 changes: 0 additions & 5 deletions examples/HelloWorldExpoWP/src/a/MyChildComp.comp.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import React, { h } from "@areslabs/wx-react"
import { View } from "@areslabs/wx-react-native"
export default class MyChildComp extends React.Component {
constructor(...args) {
super(...args)
this.__stateless__ = true
}

render() {
return h(
"block",
Expand Down
8 changes: 6 additions & 2 deletions examples/HelloWorldExpoWP/src/a/MyChildComp.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
import { WxCPTComp } from "@areslabs/wx-react"
Component(WxCPTComp())
import CompMySelf from "./MyChildComp.comp"
import { WxNormalComp } from "@areslabs/wx-react"
import RNApp from "../../src/index.js"

Component(WxNormalComp(CompMySelf, RNApp))

5 changes: 2 additions & 3 deletions examples/HelloWorldExpoWP/src/a/MyChildComp.wxml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<import src="./MyChildCompTemplate.wxml"></import>
<template wx:if="{{_r && _r.tempName}}" is="{{_r.tempName}}" data="{{..._r}}"></template>

<import src="./MyChildCompTemplate.wxml"/>
<template wx:if="{{(_r && _r.tempName) || (R && R.tempName)}}" is="{{_r.tempName || R.tempName}}" data="{{...(_r || R)}}"/>
11 changes: 5 additions & 6 deletions examples/HelloWorldExpoWP/src/a/MyChildCompTemplate.wxml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

<wxs src="../../commonwxs.wxs" module="tools" />
<wxs src="../../commonwxs.wxs" module="t" />

<template name="ITNP00005">
<block original="View" diuu="{{DIUU00001}}" tempName="ITNP00005" style="{{tools.getFinalStyle(DIUU00001style)}}">
<childrenCPT diuu="{{DIUU00002}}" style="{{tools.getFinalStyle(DIUU00002style)}}" _r="{{DIUU00002R}}"></childrenCPT>
<childrenCPT diuu="{{DIUU00003}}" style="{{tools.getFinalStyle(DIUU00003style)}}" _r="{{DIUU00003R}}"></childrenCPT>
<childrenCPT diuu="{{DIUU00004}}" style="{{tools.getFinalStyle(DIUU00004style)}}" _r="{{DIUU00004R}}"></childrenCPT>
<block original="View" diuu="{{DIUU00001}}" style="{{t.s(DIUU00001style)}}">
<childrenCPT diuu="{{DIUU00002}}" style="{{t.s(DIUU00002style)}}" R="{{DIUU00002R}}" wx:if="{{DIUU00002style !== false}}"></childrenCPT>
<childrenCPT diuu="{{DIUU00003}}" style="{{t.s(DIUU00003style)}}" R="{{DIUU00003R}}" wx:if="{{DIUU00003style !== false}}"></childrenCPT>
<childrenCPT diuu="{{DIUU00004}}" style="{{t.s(DIUU00004style)}}" R="{{DIUU00004R}}" wx:if="{{DIUU00004style !== false}}"></childrenCPT>
</block>
</template>

Expand Down
26 changes: 6 additions & 20 deletions examples/HelloWorldExpoWP/src/a/MyContext.comp.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ import PropTypes from "@areslabs/wx-prop-types"
import { View, Text } from "@areslabs/wx-react-native"
import styles from "./styles"
export default class MyContext extends Component {
constructor(...args) {
super(...args)
this.__stateless__ = true
}

render() {
return h(
"block",
Expand All @@ -30,25 +25,16 @@ export default class MyContext extends Component {
diuu: "DIUU00002"
},
h("template", {
datakey: "CTDK00002",
tempVnode: this.context.color,
"wx:if": "{{CTDK00002}}",
is: "CTNP00001",
data: "{{...CTDK00002}}"
datakey: "CTDK00001",
tempVnode: this.context.color
}),
h("template", {
datakey: "CTDK00003",
tempVnode: this.props.name,
"wx:if": "{{CTDK00003}}",
is: "CTNP00001",
data: "{{...CTDK00003}}"
datakey: "CTDK00002",
tempVnode: this.props.name
}),
h("template", {
datakey: "CTDK00004",
tempVnode: this.props.age,
"wx:if": "{{CTDK00004}}",
is: "CTNP00001",
data: "{{...CTDK00004}}"
datakey: "CTDK00003",
tempVnode: this.props.age
})
)
)
Expand Down
8 changes: 6 additions & 2 deletions examples/HelloWorldExpoWP/src/a/MyContext.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
import { WxCPTComp } from "@areslabs/wx-react"
Component(WxCPTComp())
import CompMySelf from "./MyContext.comp"
import { WxNormalComp } from "@areslabs/wx-react"
import RNApp from "../../src/index.js"

Component(WxNormalComp(CompMySelf, RNApp))

5 changes: 2 additions & 3 deletions examples/HelloWorldExpoWP/src/a/MyContext.wxml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<import src="./MyContextTemplate.wxml"></import>
<template wx:if="{{_r && _r.tempName}}" is="{{_r.tempName}}" data="{{..._r}}"></template>

<import src="./MyContextTemplate.wxml"/>
<template wx:if="{{(_r && _r.tempName) || (R && R.tempName)}}" is="{{_r.tempName || R.tempName}}" data="{{...(_r || R)}}"/>
28 changes: 11 additions & 17 deletions examples/HelloWorldExpoWP/src/a/MyContextTemplate.wxml
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@

<wxs src="../../commonwxs.wxs" module="tools" />
<wxs src="../../commonwxs.wxs" module="t" />

<template name="CTNP00001">
<block wx:if="{{isArray}}">
<block wx:for="{{v}}" wx:key="key">
<template wx:if="{{item.tempName}}" is="{{item.tempName}}" data="{{...item}}"></template>
<block wx:if="{{item.isLiteral}}">
{{item.v}}
</block>
</block>
</block>
<block wx:elif="{{isJSX}}">
<template is="{{v.tempName}}" data="{{...v}}"></template>
</block>
<block wx:elif="{{isLiteral}}">{{v}}</block>
<block wx:if="{{t.l(d)}}">{{d}}</block>
<template wx:elif="{{d.tempName}}" is="{{d.tempName}}" data="{{...d}}"/>
<block wx:else>
<block wx:for="{{d}}" wx:key="key">
<block wx:if="{{t.l(item)}}">{{item}}</block>
<template wx:else is="{{item.tempName}}" data="{{...item}}"/>
</block>
</block>
</template>


<template name="ITNP00003">
<block original="View" diuu="{{DIUU00001}}" tempName="ITNP00003" style="{{tools.getFinalStyle(DIUU00001style)}}">
<view style="{{tools.getFinalStyle(DIUU00002style)}}"><template datakey="CTDK00002" wx:if="{{CTDK00002}}" is="CTNP00001" data="{{...CTDK00002}}"></template><template datakey="CTDK00003" wx:if="{{CTDK00003}}" is="CTNP00001" data="{{...CTDK00003}}"></template><template datakey="CTDK00004" wx:if="{{CTDK00004}}" is="CTNP00001" data="{{...CTDK00004}}"></template></view>
<block original="View" diuu="{{DIUU00001}}" style="{{t.s(DIUU00001style)}}">
<view class="text" style="{{t.s(DIUU00002style)}}"><template wx:if="{{CTDK00001}} !== undefined" is="CTNP00001" data="{{d: CTDK00001}}"></template><template wx:if="{{CTDK00002}} !== undefined" is="CTNP00001" data="{{d: CTDK00002}}"></template><template wx:if="{{CTDK00003}} !== undefined" is="CTNP00001" data="{{d: CTDK00003}}"></template></view>
</block>
</template>

Expand Down
5 changes: 0 additions & 5 deletions examples/HelloWorldExpoWP/src/a/MyForceUpdate.comp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ import React, { Component, h } from "@areslabs/wx-react"
import { TouchableOpacity, View } from "@areslabs/wx-react-native"
import MyForceUpdateInner from "./MyForceUpdateInner.comp"
export default class MyForceUpdate extends Component {
constructor(...args) {
super(...args)
this.__stateless__ = false
}

shouldComponentUpdate() {
console.log("MyForceUpdate shouldComponentUpdate")
return true
Expand Down
1 change: 1 addition & 0 deletions examples/HelloWorldExpoWP/src/a/MyForceUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ import { WxNormalComp } from "@areslabs/wx-react"
import RNApp from "../../src/index.js"

Component(WxNormalComp(CompMySelf, RNApp))

5 changes: 2 additions & 3 deletions examples/HelloWorldExpoWP/src/a/MyForceUpdate.wxml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<import src="./MyForceUpdateTemplate.wxml"></import>
<template wx:if="{{_r && _r.tempName}}" is="{{_r.tempName}}" data="{{..._r}}"></template>

<import src="./MyForceUpdateTemplate.wxml"/>
<template wx:if="{{(_r && _r.tempName) || (R && R.tempName)}}" is="{{_r.tempName || R.tempName}}" data="{{...(_r || R)}}"/>
5 changes: 0 additions & 5 deletions examples/HelloWorldExpoWP/src/a/MyForceUpdateInner.comp.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import React, { Component, h } from "@areslabs/wx-react"
import MyForceUpdateInnerInner from "./MyForceUpdateInnerInner.comp"
export default class MyForceUpdateInner extends Component {
constructor(...args) {
super(...args)
this.__stateless__ = true
}

shouldComponentUpdate() {
console.log("MyForceUpdateInner shouldComponentUpdate")
return true
Expand Down
8 changes: 6 additions & 2 deletions examples/HelloWorldExpoWP/src/a/MyForceUpdateInner.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
import { WxCPTComp } from "@areslabs/wx-react"
Component(WxCPTComp())
import CompMySelf from "./MyForceUpdateInner.comp"
import { WxNormalComp } from "@areslabs/wx-react"
import RNApp from "../../src/index.js"

Component(WxNormalComp(CompMySelf, RNApp))

5 changes: 2 additions & 3 deletions examples/HelloWorldExpoWP/src/a/MyForceUpdateInner.wxml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<import src="./MyForceUpdateInnerTemplate.wxml"></import>
<template wx:if="{{_r && _r.tempName}}" is="{{_r.tempName}}" data="{{..._r}}"></template>

<import src="./MyForceUpdateInnerTemplate.wxml"/>
<template wx:if="{{(_r && _r.tempName) || (R && R.tempName)}}" is="{{_r.tempName || R.tempName}}" data="{{...(_r || R)}}"/>
12 changes: 2 additions & 10 deletions examples/HelloWorldExpoWP/src/a/MyForceUpdateInnerInner.comp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ import React, { Component, h } from "@areslabs/wx-react"
import { View, Text } from "@areslabs/wx-react-native"
import styles from "./styles"
export default class MyForceUpdateInnerInner extends Component {
constructor(...args) {
super(...args)
this.__stateless__ = true
}

shouldComponentUpdate() {
console.log("MyForceUpdateInnerInner shouldComponentUpdate")
return true
Expand All @@ -30,11 +25,8 @@ export default class MyForceUpdateInnerInner extends Component {
},
"forceUpdate: ",
h("template", {
datakey: "CTDK00002",
tempVnode: new Date().getTime(),
"wx:if": "{{CTDK00002}}",
is: "CTNP00001",
data: "{{...CTDK00002}}"
datakey: "CTDK00001",
tempVnode: new Date().getTime()
})
)
)
Expand Down
8 changes: 6 additions & 2 deletions examples/HelloWorldExpoWP/src/a/MyForceUpdateInnerInner.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
import { WxCPTComp } from "@areslabs/wx-react"
Component(WxCPTComp())
import CompMySelf from "./MyForceUpdateInnerInner.comp"
import { WxNormalComp } from "@areslabs/wx-react"
import RNApp from "../../src/index.js"

Component(WxNormalComp(CompMySelf, RNApp))

5 changes: 2 additions & 3 deletions examples/HelloWorldExpoWP/src/a/MyForceUpdateInnerInner.wxml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<import src="./MyForceUpdateInnerInnerTemplate.wxml"></import>
<template wx:if="{{_r && _r.tempName}}" is="{{_r.tempName}}" data="{{..._r}}"></template>

<import src="./MyForceUpdateInnerInnerTemplate.wxml"/>
<template wx:if="{{(_r && _r.tempName) || (R && R.tempName)}}" is="{{_r.tempName || R.tempName}}" data="{{...(_r || R)}}"/>
Loading

0 comments on commit 0ea7942

Please sign in to comment.