create-mettle-app 1.0.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +3 -13
- package/package.json +1 -1
- package/template-mettle/index.html +12 -10
- package/template-mettle/package.json +4 -6
- package/{template-mettle-jsx → template-mettle}/src/components/list.jsx +2 -5
- package/template-mettle/src/main.jsx +18 -0
- package/template-mettle/src/style/app.css +2 -2
- package/template-mettle/src/style/list.module.css +1 -1
- package/{template-mettle-jsx → template-mettle}/src/template/home.jsx +2 -7
- package/template-mettle/vite.config.js +2 -10
- package/template-mettle-apps/index.html +12 -10
- package/template-mettle-apps/package.json +5 -7
- package/template-mettle-apps/src/main.jsx +8 -0
- package/template-mettle-apps/src/router/index.js +21 -21
- package/template-mettle-apps/src/template/about.jsx +20 -0
- package/template-mettle-apps/src/template/home.jsx +40 -0
- package/template-mettle-apps/vite.config.js +2 -10
- package/template-mettle-apps-ts/README.md +1 -0
- package/{template-mettle-tsx-apps → template-mettle-apps-ts}/package.json +4 -4
- package/template-mettle-apps-ts/src/main.tsx +8 -0
- package/{template-mettle-tsx-apps → template-mettle-apps-ts}/src/router/index.ts +4 -4
- package/template-mettle-apps-ts/src/template/about.tsx +20 -0
- package/template-mettle-apps-ts/src/template/home.tsx +40 -0
- package/template-mettle-ts/README.md +1 -0
- package/{template-mettle-tsx → template-mettle-ts}/package.json +3 -3
- package/{template-mettle-tsx → template-mettle-ts}/src/components/list.tsx +2 -6
- package/template-mettle-ts/src/main.tsx +18 -0
- package/{template-mettle-tsx → template-mettle-ts}/src/style/app.css +2 -2
- package/{template-mettle-tsx → template-mettle-ts}/src/style/list.module.css +1 -1
- package/{template-mettle-tsx → template-mettle-ts}/src/template/home.tsx +2 -8
- package/template-mettle/babel.config.cjs +0 -3
- package/template-mettle/src/components/list.js +0 -43
- package/template-mettle/src/main.js +0 -20
- package/template-mettle/src/template/home.js +0 -22
- package/template-mettle-apps/babel.config.cjs +0 -3
- package/template-mettle-apps/src/main.js +0 -12
- package/template-mettle-apps/src/template/about.js +0 -23
- package/template-mettle-apps/src/template/home.js +0 -42
- package/template-mettle-jsx/README.md +0 -1
- package/template-mettle-jsx/babel.config.cjs +0 -3
- package/template-mettle-jsx/index.html +0 -13
- package/template-mettle-jsx/package.json +0 -20
- package/template-mettle-jsx/src/main.js +0 -21
- package/template-mettle-jsx/src/style/app.css +0 -14
- package/template-mettle-jsx/src/style/list.module.css +0 -27
- package/template-mettle-jsx/vite.config.js +0 -14
- package/template-mettle-jsx-apps/README.md +0 -1
- package/template-mettle-jsx-apps/babel.config.cjs +0 -3
- package/template-mettle-jsx-apps/index.html +0 -13
- package/template-mettle-jsx-apps/package.json +0 -21
- package/template-mettle-jsx-apps/src/main.js +0 -12
- package/template-mettle-jsx-apps/src/router/index.js +0 -21
- package/template-mettle-jsx-apps/src/template/about.jsx +0 -24
- package/template-mettle-jsx-apps/src/template/home.jsx +0 -44
- package/template-mettle-jsx-apps/vite.config.js +0 -14
- package/template-mettle-tsx/README.md +0 -1
- package/template-mettle-tsx/_gitignore +0 -25
- package/template-mettle-tsx/src/main.tsx +0 -21
- package/template-mettle-tsx-apps/README.md +0 -1
- package/template-mettle-tsx-apps/_gitignore +0 -25
- package/template-mettle-tsx-apps/src/main.tsx +0 -12
- package/template-mettle-tsx-apps/src/styles/app.css +0 -7
- package/template-mettle-tsx-apps/src/template/about.tsx +0 -24
- package/template-mettle-tsx-apps/src/template/home.tsx +0 -45
- /package/{template-mettle-jsx-apps → template-mettle-apps-ts}/_gitignore +0 -0
- /package/{template-mettle-tsx-apps → template-mettle-apps-ts}/index.html +0 -0
- /package/{template-mettle-jsx-apps → template-mettle-apps-ts}/src/styles/app.css +0 -0
- /package/{template-mettle-tsx-apps → template-mettle-apps-ts}/src/vite-env.d.ts +0 -0
- /package/{template-mettle-tsx-apps → template-mettle-apps-ts}/tsconfig.json +0 -0
- /package/{template-mettle-tsx-apps → template-mettle-apps-ts}/vite.config.ts +0 -0
- /package/{template-mettle-jsx → template-mettle-ts}/_gitignore +0 -0
- /package/{template-mettle-tsx → template-mettle-ts}/index.html +0 -0
- /package/{template-mettle-tsx → template-mettle-ts}/src/vite-env.d.ts +0 -0
- /package/{template-mettle-tsx → template-mettle-ts}/tsconfig.json +0 -0
- /package/{template-mettle-tsx → template-mettle-ts}/vite.config.ts +0 -0
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { defineComponent } from 'mettle';
|
|
2
|
-
import Home from './template/home';
|
|
3
|
-
import List from './components/list';
|
|
4
|
-
import './style/app.css';
|
|
5
|
-
|
|
6
|
-
defineComponent(
|
|
7
|
-
{
|
|
8
|
-
mount: '#app',
|
|
9
|
-
},
|
|
10
|
-
() => {
|
|
11
|
-
return () =>
|
|
12
|
-
html`<div class="inner">
|
|
13
|
-
<h1>Hello mettle.js</h1>
|
|
14
|
-
<div class="app-tool">
|
|
15
|
-
<component $is=${Home} />
|
|
16
|
-
<component $is=${List} />
|
|
17
|
-
</div>
|
|
18
|
-
</div>`;
|
|
19
|
-
}
|
|
20
|
-
);
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { defineComponent } from 'mettle';
|
|
2
|
-
|
|
3
|
-
const Home = defineComponent(({ setData }) => {
|
|
4
|
-
let count = 0;
|
|
5
|
-
|
|
6
|
-
function add() {
|
|
7
|
-
setData(() => {
|
|
8
|
-
count++;
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return () =>
|
|
13
|
-
html`
|
|
14
|
-
<fragment>
|
|
15
|
-
<button onClick=${add}>Add</button>
|
|
16
|
-
<h1>${count}</h1>
|
|
17
|
-
<input value=${count} />
|
|
18
|
-
</fragment>
|
|
19
|
-
`;
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
export default Home;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { defineComponent } from 'mettle';
|
|
2
|
-
import { linkTo, toParse } from 'mettle-router';
|
|
3
|
-
|
|
4
|
-
const about = () =>
|
|
5
|
-
defineComponent(() => {
|
|
6
|
-
function goHome() {
|
|
7
|
-
linkTo({
|
|
8
|
-
path: '/',
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function getOption() {
|
|
13
|
-
console.log(toParse());
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return () => html`
|
|
17
|
-
<fragment>
|
|
18
|
-
<button onClick=${goHome}>goHome</button>
|
|
19
|
-
<h1 onClick=${getOption}>About</h1>
|
|
20
|
-
</fragment>
|
|
21
|
-
`;
|
|
22
|
-
});
|
|
23
|
-
export default about;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { defineComponent } from 'mettle';
|
|
2
|
-
import { linkTo } from 'mettle-router';
|
|
3
|
-
|
|
4
|
-
const home = () =>
|
|
5
|
-
defineComponent(({ setData }) => {
|
|
6
|
-
const state = {
|
|
7
|
-
msg: 'hello',
|
|
8
|
-
arr: [1, 2],
|
|
9
|
-
count: 3,
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
function goAbout() {
|
|
13
|
-
linkTo({
|
|
14
|
-
path: '/about',
|
|
15
|
-
query: {
|
|
16
|
-
id: 1,
|
|
17
|
-
name: 'maomin',
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function useChange() {
|
|
23
|
-
setData(() => {
|
|
24
|
-
state.msg = 'world';
|
|
25
|
-
state.count++;
|
|
26
|
-
state.arr.unshift(state.count);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return () => html`
|
|
31
|
-
<fragment>
|
|
32
|
-
<button onClick=${goAbout}>goAbout</button>
|
|
33
|
-
<h1>Home</h1>
|
|
34
|
-
<p onClick=${useChange}>${state.msg}</p>
|
|
35
|
-
<ul>
|
|
36
|
-
${state.arr.map((item) => html`<li key=${item}>${item}</li>`)}
|
|
37
|
-
</ul>
|
|
38
|
-
</fragment>
|
|
39
|
-
`;
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
export default home;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# template-mettle-jsx
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>create-mettle-app</title>
|
|
7
|
-
</head>
|
|
8
|
-
|
|
9
|
-
<body>
|
|
10
|
-
<div id="app"></div>
|
|
11
|
-
<script type="module" src="/src/main.js"></script>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "template-mettle-jsx",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"license": "MIT",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"dev": "vite --open",
|
|
7
|
-
"serve": "vite preview",
|
|
8
|
-
"build": "vite build"
|
|
9
|
-
},
|
|
10
|
-
"devDependencies": {
|
|
11
|
-
"@babel/core": "^7.20.7",
|
|
12
|
-
"babel-plugin-jsx-to-mettle": "^0.1.2",
|
|
13
|
-
"babel-plugin-mettle": "^0.1.2",
|
|
14
|
-
"vite": "^4.0.0",
|
|
15
|
-
"vite-plugin-babel": "^1.1.3"
|
|
16
|
-
},
|
|
17
|
-
"dependencies": {
|
|
18
|
-
"mettle": "^0.3.1"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { defineComponent } from 'mettle';
|
|
2
|
-
import Home from './template/home';
|
|
3
|
-
import List from './components/list';
|
|
4
|
-
import './style/app.css';
|
|
5
|
-
|
|
6
|
-
defineComponent(
|
|
7
|
-
{
|
|
8
|
-
mount: '#app',
|
|
9
|
-
},
|
|
10
|
-
() => {
|
|
11
|
-
return () => (
|
|
12
|
-
<div class='inner'>
|
|
13
|
-
<h1>Hello mettle.js</h1>
|
|
14
|
-
<div class='app-tool'>
|
|
15
|
-
<component $is={Home} />
|
|
16
|
-
<component $is={List} />
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
);
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
.listInner{
|
|
2
|
-
padding: 0;
|
|
3
|
-
margin: 0;
|
|
4
|
-
width: 400px;
|
|
5
|
-
}
|
|
6
|
-
.listInner li {
|
|
7
|
-
list-style: none;
|
|
8
|
-
text-align: center;
|
|
9
|
-
font-weight: bold;
|
|
10
|
-
padding: 10px;
|
|
11
|
-
margin: 10px 0;
|
|
12
|
-
background-color: #c6715b;
|
|
13
|
-
color: #fff;
|
|
14
|
-
border-radius: 20px;
|
|
15
|
-
animation: my1 1s ease-in;
|
|
16
|
-
}
|
|
17
|
-
.listInner button {
|
|
18
|
-
margin-top: 30px;
|
|
19
|
-
}
|
|
20
|
-
@keyframes my1 {
|
|
21
|
-
from {
|
|
22
|
-
opacity: 0.2;
|
|
23
|
-
}
|
|
24
|
-
to {
|
|
25
|
-
opacity: 1;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vite';
|
|
2
|
-
import babel from 'vite-plugin-babel';
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
// options
|
|
6
|
-
server: {
|
|
7
|
-
strictPort: true,
|
|
8
|
-
port: 3002,
|
|
9
|
-
},
|
|
10
|
-
plugins: [
|
|
11
|
-
// Babel will try to pick up Babel config files (.babelrc or .babelrc.json)
|
|
12
|
-
babel(),
|
|
13
|
-
],
|
|
14
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# template-mettle-jsx-apps
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>create-mettle-app</title>
|
|
7
|
-
</head>
|
|
8
|
-
|
|
9
|
-
<body>
|
|
10
|
-
<div id="app"></div>
|
|
11
|
-
<script type="module" src="/src/main.js"></script>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "template-mettle-jsx-apps",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"license": "MIT",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"dev": "vite --open",
|
|
7
|
-
"serve": "vite preview",
|
|
8
|
-
"build": "vite build"
|
|
9
|
-
},
|
|
10
|
-
"devDependencies": {
|
|
11
|
-
"@babel/core": "^7.20.7",
|
|
12
|
-
"babel-plugin-jsx-to-mettle": "^0.1.2",
|
|
13
|
-
"babel-plugin-mettle": "^0.1.2",
|
|
14
|
-
"vite": "^4.0.0",
|
|
15
|
-
"vite-plugin-babel": "^1.1.3"
|
|
16
|
-
},
|
|
17
|
-
"dependencies": {
|
|
18
|
-
"mettle": "^0.3.1",
|
|
19
|
-
"mettle-router": "^0.2.0"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { resetView } from 'mettle';
|
|
2
|
-
import { initRouter } from 'mettle-router';
|
|
3
|
-
|
|
4
|
-
import home from '../template/home';
|
|
5
|
-
import about from '../template/about';
|
|
6
|
-
|
|
7
|
-
const router = initRouter(
|
|
8
|
-
[
|
|
9
|
-
{
|
|
10
|
-
path: '/',
|
|
11
|
-
template: home,
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
path: '/about',
|
|
15
|
-
template: about,
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
resetView
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
export default router;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { defineComponent } from 'mettle';
|
|
2
|
-
import { linkTo, toParse } from 'mettle-router';
|
|
3
|
-
|
|
4
|
-
const about = () =>
|
|
5
|
-
defineComponent(() => {
|
|
6
|
-
function goHome() {
|
|
7
|
-
linkTo({
|
|
8
|
-
path: '/',
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function getOption() {
|
|
13
|
-
console.log(toParse());
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return () => (
|
|
17
|
-
<fragment>
|
|
18
|
-
<button onClick={goHome}>goHome</button>
|
|
19
|
-
<h1 onClick={getOption}>About</h1>
|
|
20
|
-
</fragment>
|
|
21
|
-
);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export default about;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { defineComponent } from 'mettle';
|
|
2
|
-
import { linkTo } from 'mettle-router';
|
|
3
|
-
|
|
4
|
-
const home = () =>
|
|
5
|
-
defineComponent(({ setData }) => {
|
|
6
|
-
const state = {
|
|
7
|
-
msg: 'hello',
|
|
8
|
-
arr: [1, 2],
|
|
9
|
-
count: 3,
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
function goAbout() {
|
|
13
|
-
linkTo({
|
|
14
|
-
path: '/about',
|
|
15
|
-
query: {
|
|
16
|
-
id: 1,
|
|
17
|
-
name: 'maomin',
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function useChange() {
|
|
23
|
-
setData(() => {
|
|
24
|
-
state.msg = 'world';
|
|
25
|
-
state.count++;
|
|
26
|
-
state.arr.unshift(state.count);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return () => (
|
|
31
|
-
<fragment>
|
|
32
|
-
<button onClick={goAbout}>goAbout</button>
|
|
33
|
-
<h1>Home</h1>
|
|
34
|
-
<p onClick={useChange}>{state.msg}</p>
|
|
35
|
-
<ul>
|
|
36
|
-
{state.arr.map((item) => (
|
|
37
|
-
<li key={item}>{item}</li>
|
|
38
|
-
))}
|
|
39
|
-
</ul>
|
|
40
|
-
</fragment>
|
|
41
|
-
);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
export default home;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vite';
|
|
2
|
-
import babel from 'vite-plugin-babel';
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
// options
|
|
6
|
-
server: {
|
|
7
|
-
strictPort: true,
|
|
8
|
-
port: 3002,
|
|
9
|
-
},
|
|
10
|
-
plugins: [
|
|
11
|
-
// Babel will try to pick up Babel config files (.babelrc or .babelrc.json)
|
|
12
|
-
babel(),
|
|
13
|
-
],
|
|
14
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# template-mettle-tsx
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
.DS_Store
|
|
2
|
-
node_modules
|
|
3
|
-
/dist
|
|
4
|
-
/buildDir
|
|
5
|
-
.parcel-cache
|
|
6
|
-
|
|
7
|
-
# local env files
|
|
8
|
-
.env.local
|
|
9
|
-
.env.*.local
|
|
10
|
-
|
|
11
|
-
# Log files
|
|
12
|
-
npm-debug.log*
|
|
13
|
-
yarn-debug.log*
|
|
14
|
-
yarn-error.log*
|
|
15
|
-
pnpm-debug.log*
|
|
16
|
-
|
|
17
|
-
# Editor directories and files
|
|
18
|
-
.idea
|
|
19
|
-
.vscode
|
|
20
|
-
*.suo
|
|
21
|
-
*.ntvs*
|
|
22
|
-
*.njsproj
|
|
23
|
-
*.sln
|
|
24
|
-
*.sw?
|
|
25
|
-
yarn.lock
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { defineComponent } from 'mettle';
|
|
2
|
-
import Home from './template/home';
|
|
3
|
-
import List from './components/list';
|
|
4
|
-
import './style/app.css';
|
|
5
|
-
|
|
6
|
-
defineComponent(
|
|
7
|
-
{
|
|
8
|
-
mount: '#app',
|
|
9
|
-
},
|
|
10
|
-
() => {
|
|
11
|
-
return () => (
|
|
12
|
-
<div class='inner'>
|
|
13
|
-
<h1>Hello mettle.js</h1>
|
|
14
|
-
<div class='app-tool'>
|
|
15
|
-
<component $is={Home} />
|
|
16
|
-
<component $is={List} />
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# template-mettle-tsx-apps
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
.DS_Store
|
|
2
|
-
node_modules
|
|
3
|
-
/dist
|
|
4
|
-
/buildDir
|
|
5
|
-
.parcel-cache
|
|
6
|
-
|
|
7
|
-
# local env files
|
|
8
|
-
.env.local
|
|
9
|
-
.env.*.local
|
|
10
|
-
|
|
11
|
-
# Log files
|
|
12
|
-
npm-debug.log*
|
|
13
|
-
yarn-debug.log*
|
|
14
|
-
yarn-error.log*
|
|
15
|
-
pnpm-debug.log*
|
|
16
|
-
|
|
17
|
-
# Editor directories and files
|
|
18
|
-
.idea
|
|
19
|
-
.vscode
|
|
20
|
-
*.suo
|
|
21
|
-
*.ntvs*
|
|
22
|
-
*.njsproj
|
|
23
|
-
*.sln
|
|
24
|
-
*.sw?
|
|
25
|
-
yarn.lock
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { defineComponent } from 'mettle';
|
|
2
|
-
import { linkTo, toParse } from 'mettle-router';
|
|
3
|
-
|
|
4
|
-
const about = () =>
|
|
5
|
-
defineComponent(() => {
|
|
6
|
-
function goHome() {
|
|
7
|
-
linkTo({
|
|
8
|
-
path: '/',
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function getOption() {
|
|
13
|
-
console.log(toParse());
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return () => (
|
|
17
|
-
<fragment>
|
|
18
|
-
<button onClick={goHome}>goHome</button>
|
|
19
|
-
<h1 onClick={getOption}>About</h1>
|
|
20
|
-
</fragment>
|
|
21
|
-
);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export default about;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { defineComponent } from 'mettle';
|
|
2
|
-
import { linkTo } from 'mettle-router';
|
|
3
|
-
import type { OptionsProps } from 'mettle';
|
|
4
|
-
|
|
5
|
-
const home = () =>
|
|
6
|
-
defineComponent(({ setData }:OptionsProps) => {
|
|
7
|
-
const state = {
|
|
8
|
-
msg: 'hello',
|
|
9
|
-
arr: [1, 2],
|
|
10
|
-
count: 3,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
function goAbout() {
|
|
14
|
-
linkTo({
|
|
15
|
-
path: '/about',
|
|
16
|
-
query: {
|
|
17
|
-
id: 1,
|
|
18
|
-
name: 'maomin',
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function useChange() {
|
|
24
|
-
setData(() => {
|
|
25
|
-
state.msg = 'world';
|
|
26
|
-
state.count++;
|
|
27
|
-
state.arr.unshift(state.count);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return () => (
|
|
32
|
-
<fragment>
|
|
33
|
-
<button onClick={goAbout}>goAbout</button>
|
|
34
|
-
<h1>Home</h1>
|
|
35
|
-
<p onClick={useChange}>{state.msg}</p>
|
|
36
|
-
<ul>
|
|
37
|
-
{state.arr.map((item) => (
|
|
38
|
-
<li key={item}>{item}</li>
|
|
39
|
-
))}
|
|
40
|
-
</ul>
|
|
41
|
-
</fragment>
|
|
42
|
-
);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
export default home;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|