UNPKG

1.05 kBJavaScriptView Raw
1<%if (['react', 'preact'].includes(framework)) {-%>
2import { Component } from 'react'
3<%} else if (framework === 'nerv') { -%>
4import { Component } from 'nervjs'
5<%} else if (framework === 'vue') { -%>
6import Vue from 'vue'
7<%} else if (framework === 'vue3') { -%>
8import { createApp } from 'vue'
9<%}-%>
10import './app.<%= cssExt %>'
11
12<% if (['react', 'preact', 'nerv'].includes(framework)) { -%>
13class App extends Component {
14
15 componentDidMount () {}
16
17 componentDidShow () {}
18
19 componentDidHide () {}
20
21 componentDidCatchError () {}
22
23 // this.props.children 是将要会渲染的页面
24 render () {
25 return this.props.children
26 }
27}
28<%}-%>
29<% if (framework === 'vue') { -%>
30const App = {
31 onShow (options) {
32 },
33 render(h) {
34 // this.$slots.default 是将要会渲染的页面
35 return h('block', this.$slots.default)
36 }
37}
38<%}-%>
39<% if (framework === 'vue3') { -%>
40const App = createApp({
41 onShow (options) {},
42 // 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖
43})
44<%}-%>
45
46export default App