Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP]Feat/add files for miniapp projects #43

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions scaffolds/app-js/mini.project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"miniprogramRoot": "miniprogram",
"scripts": {
"beforeUpload": "npm run build"
}
}
2 changes: 1 addition & 1 deletion scaffolds/app-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@rax-materials/scaffolds-app-js",
"author": "rax",
"description": "Rax 无线跨端应用工程,使用 JavaScript。",
"version": "0.4.2",
"version": "0.4.3",
"scripts": {
"start": "rax-app start",
"build": "rax-app build",
Expand Down
23 changes: 23 additions & 0 deletions scaffolds/app-js/src/miniapp-compiled/Card/index.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.card {
align-items: center;
margin-top: 20rpx;
box-sizing: border-box;
border-radius: 8rpx;
width: 100%;
padding: 12rpx 0;
background-color: #eee;
}

.title {
height: 60rpx;
line-height: 60rpx;
font-weight: 700;
position: relative;
margin-bottom: 8rpx;
border-bottom: 1rpx solid #000;
}

.content {
color: rgb(48, 47, 47);
font-size: 28rpx;
}
14 changes: 14 additions & 0 deletions scaffolds/app-js/src/miniapp-compiled/Card/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { createElement } from 'rax';
import View from 'rax-view';

import styles from './index.module.css';

export default function Card(props) {
const { title, content } = props;
return (
<View className={styles.card}>
<View className={styles.title}>{title}</View>
<View className={styles.content}>{content}</View>
</View>
);
}
5 changes: 5 additions & 0 deletions scaffolds/app-js/src/miniapp-compiled/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Card from './Card';

export {
Card,
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import Text from 'rax-text';
import styles from './index.module.css';

import Logo from '@/components/Logo';
<%_ if (targets.includes('miniapp') || targets.includes('wechat-miniprogram')) { -%>
import Card from '../../miniapp-compiled/Card/index';
<%_ } %>

export default function Home() {
return (
Expand All @@ -13,6 +16,9 @@ export default function Home() {
<Text className={styles.homeTitle}>Welcome to Your Rax App</Text>
<Text className={styles.homeInfo}>More information about Rax</Text>
<Text className={styles.homeInfo}>Visit https://rax.js.org</Text>
<%_ if (targets.includes('miniapp') || targets.includes('wechat-miniprogram')) { -%>
<Card title="这是一个 Rax 小程序编译时组件" content="详情查看 https://rax.js.org/docs/guide/dual-engine-mix" />
<%_ } %>
</View>
);
}
6 changes: 6 additions & 0 deletions scaffolds/app-ts/mini.project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"miniprogramRoot": "miniprogram",
"scripts": {
"beforeUpload": "npm run build"
}
}
2 changes: 1 addition & 1 deletion scaffolds/app-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@rax-materials/scaffolds-app-ts",
"author": "rax",
"description": "Rax 无线跨端应用工程,使用 TypeScript。",
"version": "0.4.2",
"version": "0.4.3",
"scripts": {
"start": "rax-app start",
"build": "rax-app build",
Expand Down
23 changes: 23 additions & 0 deletions scaffolds/app-ts/src/miniapp-compiled/Card/index.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.card {
align-items: center;
margin-top: 20rpx;
box-sizing: border-box;
border-radius: 8rpx;
width: 100%;
padding: 12rpx 0;
background-color: #eee;
}

.title {
height: 60rpx;
line-height: 60rpx;
font-weight: 700;
position: relative;
margin-bottom: 8rpx;
border-bottom: 1rpx solid #000;
}

.content {
color: rgb(48, 47, 47);
font-size: 28rpx;
}
14 changes: 14 additions & 0 deletions scaffolds/app-ts/src/miniapp-compiled/Card/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { createElement } from 'rax';
import View from 'rax-view';

import styles from './index.module.css';

export default function Card(props) {
const { title, content } = props;
return (
<View className={styles.card}>
<View className={styles.title}>{title}</View>
<View className={styles.content}>{content}</View>
</View>
);
}
5 changes: 5 additions & 0 deletions scaffolds/app-ts/src/miniapp-compiled/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Card from './Card';

export {
Card,
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import View from 'rax-view';
import Text from 'rax-text';

import styles from './index.module.css';
import Logo from '../../components/Logo';

import Logo from '@/components/Logo';
<%_ if (targets.includes('miniapp') || targets.includes('wechat-miniprogram')) { -%>
import Card from '../../miniapp-compiled/Card/index';
<%_ } %>

export default function Home() {
return (
Expand All @@ -12,6 +16,9 @@ export default function Home() {
<Text className={styles.homeTitle}>Welcome to Your Rax App</Text>
<Text className={styles.homeInfo}>More information about Rax</Text>
<Text className={styles.homeInfo}>Visit https://rax.js.org</Text>
<%_ if (targets.includes('miniapp') || targets.includes('wechat-miniprogram')) { -%>
<Card title="这是一个 Rax 小程序编译时组件" content="详情查看 https://rax.js.org/docs/guide/dual-engine-mix" />
<%_ } %>
</View>
);
}