提交 0c6c9a4f 编写于 作者: DCloud-yyl's avatar DCloud-yyl

适配支持uni-app x项目

上级 e4551004
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
<script lang="uts">
let firstBackTime = 0
export default {
onLaunch: function () {
console.log('App Launch')
},
onShow: function () {
console.log('App Show')
},
onHide: function () {
console.log('App Hide')
},
onLastPageBackPress: function () {
console.log('App LastPageBackPress')
if (firstBackTime == 0) {
uni.showToast({
title: '再按一次退出应用',
position: 'bottom',
})
firstBackTime = Date.now()
setTimeout(() => {
firstBackTime = 0
}, 2000)
} else if (Date.now() - firstBackTime < 2000) {
firstBackTime = Date.now()
uni.exit()
}
},
onExit: function () {
console.log('App Exit')
},
}
</script>
<style>
/*每个页面公共css */
.uni-row {
flex-direction: row;
}
.uni-column {
flex-direction: column;
}
</style>
\ No newline at end of file
import App from './App'
import { createSSRApp } from 'vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
\ No newline at end of file
{ {
"name" : "uni-api", "name": "uni-api",
"appid" : "__UNI__ED9218B", "appid": "__UNI__ED9218B",
"description" : "", "description": "uts插件示例",
"versionName" : "1.0.0", "versionName": "1.0.0",
"versionCode" : "100", "versionCode": "100",
"transformPx" : false, "transformPx": false,
/* 5+App特有相关 */ /* uni-app x 特有相关 */
"app-plus" : { // "uni-app-x": {},
"usingComponents" : true, /* uni-app特有相关 */
"nvueStyleCompiler" : "uni-app", "app-plus": {
"compilerVersion" : 3, "usingComponents": true,
"splashscreen" : { "nvueStyleCompiler": "uni-app",
"alwaysShowBeforeRender" : true, "compilerVersion": 3,
"waiting" : true, "splashscreen": {
"autoclose" : true, "alwaysShowBeforeRender": true,
"delay" : 0 "waiting": true,
}, "autoclose": true,
/* 模块配置 */ "delay": 0
"modules" : {}, },
/* 应用发布信息 */ /* 模块配置 */
"distribute" : { "modules": {},
/* android打包配置 */ /* 应用发布信息 */
"android" : { "distribute": {
"permissions" : [ /* android打包配置 */
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", "android": {},
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", /* ios打包配置 */
"<uses-permission android:name=\"android.permission.VIBRATE\"/>", "ios": {},
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>", /* SDK配置 */
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", "sdkConfigs": {}
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", }
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", },
"<uses-permission android:name=\"android.permission.CAMERA\"/>", /* 快应用特有相关 */
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>", "quickapp": {},
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", /* 小程序特有相关 */
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", "mp-weixin": {
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", "appid": "",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", "setting": {
"<uses-feature android:name=\"android.hardware.camera\"/>", "urlCheck": false
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" },
] "usingComponents": true
}, },
/* ios打包配置 */ "mp-alipay": {
"ios" : {}, "usingComponents": true
/* SDK配置 */ },
"sdkConfigs" : {} "mp-baidu": {
} "usingComponents": true
}, },
/* 快应用特有相关 */ "mp-toutiao": {
"quickapp" : {}, "usingComponents": true
/* 小程序特有相关 */ },
"mp-weixin" : { "uniStatistics": {
"appid" : "", "enable": false
"setting" : { },
"urlCheck" : false "vueVersion": "3"
},
"usingComponents" : true
},
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics" : {
"enable" : false
},
"vueVersion" : "3"
} }
{ {
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{ {
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
"navigationBarTitleText": "uni-app" "navigationBarTitleText": "uni-api"
} }
} },
], {
"globalStyle": { "path": "pages/test/test",
"navigationBarTextStyle": "black", "style": {
"navigationBarTitleText": "uni-app", "navigationBarTitleText": "测试示例",
"navigationBarBackgroundColor": "#F8F8F8", "enablePullDownRefresh": false
"backgroundColor": "#F8F8F8" }
}, }
"uniIdRouter": {} ],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"uniIdRouter": {}
} }
<template>
<!-- #ifdef APP -->
<scroll-view class="content">
<!-- #endif -->
<image class="logo" src="/static/logo.png"></image>
<view class="text-area">
<text class="title">{{title}}</text>
</view>
<view class="buttons">
<button class="button" @tap="openTest" type="primary">测试示例</button>
</view>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
<script>
export default {
data() {
return {
title: 'Hello'
}
},
methods: {
openTest() {
uni.navigateTo({
url: '/pages/test/test'
})
}
}
}
</script>
<style>
.content {
display: flex;
flex: 1;
align-items: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-bottom: 50rpx;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
.buttons {
margin-top: 50px;
margin-bottom: 50px;
}
.button {
width: 640rpx;
margin: 10px;
}
</style>
\ No newline at end of file
<template>
<!-- #ifdef APP -->
<scroll-view class="content">
<!-- #endif -->
<image class="logo" src="/static/logo.png"></image>
<view class="text-area">
<text class="title">{{title}}</text>
</view>
<view class="buttons">
<button class="button" @tap="openTest" type="primary">测试示例</button>
</view>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
<script>
export default {
data() {
return {
title: 'Hello'
}
},
methods: {
openTest() {
uni.navigateTo({
url: '/pages/test/test'
})
}
}
}
</script>
<style>
.content {
display: flex;
flex: 1;
align-items: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-bottom: 50rpx;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
.buttons {
margin-top: 50px;
margin-bottom: 50px;
}
.button {
width: 640rpx;
margin: 10px;
}
</style>
\ No newline at end of file
<template>
<!-- #ifdef APP -->
<scroll-view class="content">
<!-- #endif -->
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
.content {
display: flex;
flex: 1;
align-items: center;
}
</style>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册