fix: remove omim from vite template

This commit is contained in:
dntzhang 2021-06-17 09:16:34 +08:00
parent 9fa660b4bd
commit c422df7c94
5 changed files with 49 additions and 52 deletions

View File

@ -25,7 +25,7 @@ Directory description:
| **Template Type**| **Command**| **Describe**|
| ------------ | -----------| ----------------- |
|Vite Template(v3.5.0+)|`omi init-vite my-app`| Basic omi template with vite.|
|Vite Template(v3.5.1+)|`omi init-vite my-app`| Basic omi template with vite.|
|Base Template(v3.3.0+)|`omi init my-app`| Basic omi project template.|
|TypeScript Template(omi-cli v3.3.0+)|`omi init-ts my-app`|Basic omi template with typescript.|
|Mobile Template|`omi init-weui my-app`| Mobile web app template with weui and omi-router.|

View File

@ -1,6 +1,6 @@
{
"name": "omi-cli",
"version": "3.5.0",
"version": "3.5.1",
"description": "Create website, app with no build configuration, be friendly to [Omi](https://github.com/Tencent/omi) framework.",
"main": "bin/omi",
"engines": {

View File

@ -2,7 +2,7 @@
"version": "0.0.0",
"scripts": {
"start": "vite",
"build": "tsc && vite build",
"build": "tsc && vite build --base=./",
"serve": "vite preview"
},
"devDependencies": {
@ -11,7 +11,6 @@
"vite": "^2.3.7"
},
"dependencies": {
"omi": "latest",
"omim": "latest"
"omi": "latest"
}
}
}

View File

@ -1,37 +1,37 @@
import { WeElement, h, tag } from 'omi'
interface HelloOmiProps {
msg: string
onAbc: (evt: CustomEvent) => void
msg: string
onAbc: (evt: CustomEvent) => void
}
const tagName = 'hello-omi'
declare global {
namespace JSX {
interface IntrinsicElements {
[tagName]: Omi.Props & HelloOmiProps
}
}
namespace JSX {
interface IntrinsicElements {
[tagName]: Omi.Props & HelloOmiProps
}
}
}
@tag(tagName)
export default class extends WeElement<HelloOmiProps> {
static css = `div {
static css = `div {
color: red;
cursor: pointer;
}`
onClick = (evt: Event) => {
// trigger CustomEvent
this.fire('Abc', { name: 'dntzhang & f & xcatliu', age: 12 })
evt.stopPropagation()
}
onClick = (evt: Event) => {
// trigger CustomEvent
this.fire('Abc', { name: 'omi', age: 5 })
evt.stopPropagation()
}
render() {
return (
<div onClick={this.onClick}>
<div> Hello {this.props.msg} Click Me!</div>
</div>
)
}
}
render() {
return (
<div onClick={this.onClick}>
<div> Hello {this.props.msg} Click Me!</div>
</div>
)
}
}

View File

@ -3,43 +3,41 @@ import './hello-omi'
import './index.css'
import * as css from './_index.less'
import logo from './logo.svg'
import 'omim/text-field'
interface MyAppProps {
name: string
name: string
}
@tag('my-app')
export default class extends WeElement<MyAppProps> {
static css = css.default
static css = css.default
abc: string
abc: string
onAbc = (evt: CustomEvent) => {
this.abc = ` by ${evt.detail.name}`
this.update()
}
onAbc = (evt: CustomEvent) => {
this.abc = ` by ${evt.detail.name}`
this.update()
}
render(props) {
return (
<div class="app">
<header class="app-header">
<img
src={logo}
class="app-logo"
alt="logo"
/>
<h1 class="app-title">Welcome to {props.name}</h1>
</header>
{this.abc}
<hello-omi onAbc={this.onAbc} msg="Omi"></hello-omi>
render(props) {
return (
<div class="app">
<header class="app-header">
<img
src={logo}
class="app-logo"
alt="logo"
/>
<h1 class="app-title">Welcome to {props.name}</h1>
</header>
{this.abc}
<hello-omi onAbc={this.onAbc} msg="Omi"></hello-omi>
<m-text-field label='test'></m-text-field>
</div>
)
}
</div>
)
}
}
render(<my-app name='Omi'></my-app>, '#root')