[ERROR] : [Vue warn]: Failed to mount component: template or render function not defined.
(found in <Root>) __ERROR
错误
看mpType是否正确,默认是配置:‘app’
app.vue
import Vue from 'vue'
import App from './App'
import pageHead from './components/page-head.vue' //全局引用page-head组件
Vue.config.productionTip = false
Vue.component('page-head', pageHead) //全局注册page-head组件,每个页面将可以直接使用该组件
App.mpType = 'app' // 确保mpType
const app = new Vue({
...App
})
app.$mount() //挂载Vue实例
使用Vue.use引用插件,使用Vue.prototype添加全局变量,使用Vue.component注册全局组件。
可以引用vuex,因涉及多个文件,此处没有提供示例,详见hello uni-app示例工程。
无法使用vue-router,路由须在pages.json中进行配置。
https://nativesupport.dcloud.net.cn/AppDocs/usesdk/android
云打包
安卓打包,密钥生成
keytool -genkey -alias testalias -keyalg RSA -keysize 2048 -validity 36500 -keystore test.keystore
IOS打包
https://nativesupport.dcloud.net.cn/AppDocs/usesdk/ios
申请证书