-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
426 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# IsHttps | ||
|
||
## Description | ||
是否是https协议 | ||
|
||
## Run Online | ||
|
||
<RunCode :language="ts"> | ||
|
||
```ts | ||
console.log(isHttps()) | ||
``` | ||
|
||
</RunCode> | ||
|
||
## Options | ||
|
||
<div class="utils-table"> | ||
|
||
| 属性名 | 说明 | 类型 | 默认值 | | ||
| --- | --- | --- | --- | | ||
|
||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { isHttps } from "./isHttps"; | ||
|
||
console.log(isHttps()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* @desc 是否是https协议 | ||
* | ||
* @func isHttps | ||
* @returns { boolean } 校验结果 | ||
*/ | ||
export function isHttps(): boolean { | ||
const protocol = window.location.protocol | ||
if (protocol === 'https:') { | ||
return true | ||
} | ||
else if (protocol === 'http:') { | ||
return false | ||
} | ||
else { | ||
const baseUrl = window.location.origin | ||
return baseUrl.startsWith('https:') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.