Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
tswj
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2022-05-14 23:33:40 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8a04c906f93f45382b1e38f7ee14522a20ff55d3
8a04c906
1 parent
f7299280
新增环境变量类型定义,智能提示
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
src/env.d.ts
src/views/auth.vue
src/views/business/login.vue
src/env.d.ts
0 → 100644
View file @
8a04c90
interface
ImportMetaEnv
extends
Readonly
<
Record
<
string
,
string
>>
{
readonly
VITE_OPENID
:
string
readonly
VITE_ID
:
string
readonly
VITE_PIN
:
string
}
interface
ImportMeta
{
readonly
env
:
ImportMetaEnv
}
src/views/auth.vue
View file @
8a04c90
...
...
@@ -11,8 +11,7 @@ const $route = useRoute();
onMounted(() => {
// php需要先跳转链接获取openid
let url = encodeURIComponent(location.origin + location.pathname + $route.query.href); // 未授权的地址
if (process.env.NODE_ENV === 'development') {
// TAG: 开发环境测试数据
if (import.meta.env.DEV) { // TAG: 开发环境测试数据
location.href = `/srv/?f=voice&a=openid_${$route.query.userType}&res=${url}&input_openid=${import.meta.env.VITE_OPENID}`
} else {
location.href = `/srv/?f=voice&a=openid_${$route.query.userType}&res=${url}`;
...
...
src/views/business/login.vue
View file @
8a04c90
...
...
@@ -73,7 +73,7 @@ const validator = (val) => {
const phone = ref('');
const code = ref('');
// TAG: 开发环境测试数据
if (
process.env.NODE_ENV === 'development'
) {
if (
import.meta.env.DEV
) {
phone.value = import.meta.env.VITE_ID
code.value = import.meta.env.VITE_PIN
}
...
...
Please
register
or
login
to post a comment