Skip to content

Commit

Permalink
chore: commit uni-app vue3
Browse files Browse the repository at this point in the history
  • Loading branch information
sonofmagic committed Sep 12, 2023
1 parent 1f4e4ce commit 5b537b1
Show file tree
Hide file tree
Showing 21 changed files with 6,429 additions and 655 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
registry=http://registry.npmmirror.com/
git-checks=false
shamefully-hoist=true
Empty file removed apps/.gitkeep
Empty file.
20 changes: 20 additions & 0 deletions apps/uni-app-vue3/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
76 changes: 76 additions & 0 deletions apps/uni-app-vue3/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"name": "uni-preset-vue",
"version": "0.0.0",
"scripts": {
"dev": "npm run dev:mp-weixin",
"dev:app": "uni -p app",
"dev:app-android": "uni -p app-android",
"dev:app-ios": "uni -p app-ios",
"dev:custom": "uni -p",
"dev:h5": "uni",
"dev:h5:ssr": "uni --ssr",
"dev:mp-alipay": "uni -p mp-alipay",
"dev:mp-baidu": "uni -p mp-baidu",
"dev:mp-jd": "uni -p mp-jd",
"dev:mp-kuaishou": "uni -p mp-kuaishou",
"dev:mp-lark": "uni -p mp-lark",
"dev:mp-qq": "uni -p mp-qq",
"dev:mp-toutiao": "uni -p mp-toutiao",
"dev:mp-weixin": "uni -p mp-weixin",
"dev:quickapp-webview": "uni -p quickapp-webview",
"dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",
"dev:quickapp-webview-union": "uni -p quickapp-webview-union",
"build:app": "uni build -p app",
"build:app-android": "uni build -p app-android",
"build:app-ios": "uni build -p app-ios",
"build:custom": "uni build -p",
"build:h5": "uni build",
"build:h5:ssr": "uni build --ssr",
"build:mp-alipay": "uni build -p mp-alipay",
"build:mp-baidu": "uni build -p mp-baidu",
"build:mp-jd": "uni build -p mp-jd",
"build:mp-kuaishou": "uni build -p mp-kuaishou",
"build:mp-lark": "uni build -p mp-lark",
"build:mp-qq": "uni build -p mp-qq",
"build:mp-toutiao": "uni build -p mp-toutiao",
"build:mp-weixin": "uni build -p mp-weixin",
"build:quickapp-webview": "uni build -p quickapp-webview",
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
"build:quickapp-webview-union": "uni build -p quickapp-webview-union",
"type-check": "vue-tsc --noEmit"
},
"dependencies": {
"@dcloudio/uni-app": "3.0.0-3081220230817001",
"@dcloudio/uni-app-plus": "3.0.0-3081220230817001",
"@dcloudio/uni-components": "3.0.0-3081220230817001",
"@dcloudio/uni-h5": "3.0.0-3081220230817001",
"@dcloudio/uni-mp-alipay": "3.0.0-3081220230817001",
"@dcloudio/uni-mp-baidu": "3.0.0-3081220230817001",
"@dcloudio/uni-mp-jd": "3.0.0-3081220230817001",
"@dcloudio/uni-mp-kuaishou": "3.0.0-3081220230817001",
"@dcloudio/uni-mp-lark": "3.0.0-3081220230817001",
"@dcloudio/uni-mp-qq": "3.0.0-3081220230817001",
"@dcloudio/uni-mp-toutiao": "3.0.0-3081220230817001",
"@dcloudio/uni-mp-weixin": "3.0.0-3081220230817001",
"@dcloudio/uni-quickapp-webview": "3.0.0-3081220230817001",
"@weapp-core/http": "workspace:^",
"socket.io-client": "^4.7.2",
"vue": "^3.2.45",
"vue-i18n": "^9.1.9"
},
"devDependencies": {
"@dcloudio/types": "^3.3.2",
"@dcloudio/uni-automator": "3.0.0-3081220230817001",
"@dcloudio/uni-cli-shared": "3.0.0-3081220230817001",
"@dcloudio/uni-stacktracey": "3.0.0-3081220230817001",
"@dcloudio/vite-plugin-uni": "3.0.0-3081220230817001",
"@rollup/plugin-inject": "^5.0.3",
"@rollup/plugin-node-resolve": "^15.2.1",
"@rollup/plugin-replace": "^5.0.2",
"@vue/runtime-core": "^3.2.45",
"@vue/tsconfig": "^0.1.3",
"typescript": "^4.9.4",
"vite": "4.1.4",
"vue-tsc": "^1.0.24"
}
}
28 changes: 28 additions & 0 deletions apps/uni-app-vue3/project.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"appid": "wx6ffee4673b257014",
"compileType": "miniprogram",
"libVersion": "3.0.2",
"packOptions": {
"ignore": [],
"include": []
},
"setting": {
"coverView": true,
"es6": true,
"postcss": true,
"minified": true,
"enhance": true,
"showShadowRootInWxmlPanel": true,
"packNpmRelationList": [],
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
},
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
}
}
7 changes: 7 additions & 0 deletions apps/uni-app-vue3/project.private.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "uni-app-vue3",
"setting": {
"compileHotReLoad": true
}
}
10 changes: 10 additions & 0 deletions apps/uni-app-vue3/shims-uni.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/// <reference types='@dcloudio/types' />
import 'vue'

declare module '@vue/runtime-core' {
type Hooks = App.AppInstance & Page.PageInstance;

interface ComponentCustomOptions extends Hooks {

}
}
15 changes: 15 additions & 0 deletions apps/uni-app-vue3/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script setup lang="ts">
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
onLaunch(() => {
console.log("App Launch");
console.log(globalThis, global, window, self)
console.log(globalThis.getApp === getApp)
});
onShow(() => {
console.log("App Show");
});
onHide(() => {
console.log("App Hide");
});
</script>
<style></style>
8 changes: 8 additions & 0 deletions apps/uni-app-vue3/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/// <reference types="vite/client" />

declare module '*.vue' {
import { DefineComponent } from 'vue'
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any>
export default component
}
11 changes: 11 additions & 0 deletions apps/uni-app-vue3/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// import { WebSocket, XMLHttpRequest } from '@weapp-core/http'
import { createSSRApp } from 'vue'
import App from './App.vue'
// globalThis.WebSocket = WebSocket
// globalThis.XMLHttpRequest = XMLHttpRequest
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
72 changes: 72 additions & 0 deletions apps/uni-app-vue3/src/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"name" : "",
"appid" : "",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
},
/* 模块配置 */
"modules" : {},
/* 应用发布信息 */
"distribute" : {
/* android打包配置 */
"android" : {
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<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\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
/* ios打包配置 */
"ios" : {},
/* SDK配置 */
"sdkConfigs" : {}
}
},
/* 快应用特有相关 */
"quickapp" : {},
/* 小程序特有相关 */
"mp-weixin" : {
"appid" : "",
"setting" : {
"urlCheck" : false
},
"usingComponents" : true
},
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics": {
"enable": false
},
"vueVersion" : "3"
}
16 changes: 16 additions & 0 deletions apps/uni-app-vue3/src/pages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "uni-app"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
}
}
46 changes: 46 additions & 0 deletions apps/uni-app-vue3/src/pages/index/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<template>
<view>

</view>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
// import { io } from 'socket.io-client'
onLoad(() => {
console.log('onLoad', XMLHttpRequest, WebSocket)
// const socket = io('http://localhost:3000/events', {
// reconnectionDelayMax: 10000,
// auth: {
// token: '123'
// },
// query: {
// 'my-key': 'my-value'
// },
// transports: ['polling', 'websocket']
// })
// socket.on('connect', function () {
// console.log('Connected')
// socket.emit('events', { test: 'test' })
// socket.emit('identity', 0, (response) => console.log('Identity:', response))
// })
// socket.on('events', function (data) {
// console.log('event', data)
// })
// socket.on('exception', function (data) {
// console.log('event', data)
// })
// socket.on('disconnect', function () {
// console.log('Disconnected')
// })
// socket.on('connect_error', (error) => {
// console.error(error)
// })
})
</script>

<style></style>
6 changes: 6 additions & 0 deletions apps/uni-app-vue3/src/shime-uni.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export {}

declare module "vue" {
type Hooks = App.AppInstance & Page.PageInstance;
interface ComponentCustomOptions extends Hooks {}
}
6 changes: 6 additions & 0 deletions apps/uni-app-vue3/src/shims.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// XMLHttpRequest: ['@weapp-core/http', 'XMLHttpRequest'],
// WebSocket: ['@weapp-core/http', 'WebSocket'],

export const window = globalThis

export const self = globalThis
Loading

0 comments on commit 5b537b1

Please sign in to comment.