Skip to content

Commit 623d264

Browse files
committed
publish 3.4.0
1 parent f786b1a commit 623d264

File tree

4 files changed

+28
-14
lines changed

4 files changed

+28
-14
lines changed

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ A web-side command line plugin built by `Vue`, supports multiple message formats
2222
* Supports real-time content display and appending, and can create simple animation effects
2323
* Support user question and answer input
2424
* Support online text editing
25-
* Support Highlight, Codemirror code highlighting
2625
* Support window dragging and fixing
2726
* Support ← → cursor key switching and ↑ ↓ key history command switching
2827
* Support fullscreen
@@ -65,18 +64,24 @@ npm install [email protected] --save
6564
npm install [email protected] --save
6665
```
6766

68-
Use Terminal plugin in `main.js`
67+
Use Terminal plugin in `main`
6968

69+
**Vue2**
7070
```js
7171
import Terminal from 'vue-web-terminal'
7272

73-
// for vue2
7473
Vue.use(Terminal)
74+
```
75+
76+
**Vue3**
77+
```ts
78+
import { createTerminal } from 'vue-web-terminal'
7579

76-
// for vue3
7780
const app = createApp(App)
78-
.use(Terminal)
79-
.mount('#app')
81+
82+
app.use(createTerminal())
83+
84+
app.mount('#app')
8085
```
8186

8287
Example:

README_ZH.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
* 支持内容实时回显、追加,可制作简单的动画效果
2424
* 支持用户问答输入
2525
* 支持在线文本编辑
26-
* 支持Highlight、Codemirror代码高亮
2726
* 支持窗口拖拽、固定
2827
* 支持 ← → 光标键切换和 ↑ ↓ 键历史命令切换
2928
* 支持一键全屏
@@ -63,18 +62,24 @@ npm install [email protected] --save
6362
npm install [email protected] --save
6463
```
6564

66-
main.js中载入 Terminal 插件
65+
`main`中载入 Terminal 插件
6766

67+
**Vue2**
6868
```js
6969
import Terminal from 'vue-web-terminal'
7070

71-
// for vue2
7271
Vue.use(Terminal)
72+
```
73+
74+
**Vue3**
75+
```ts
76+
import { createTerminal } from 'vue-web-terminal'
7377

74-
// for vue3
7578
const app = createApp(App)
76-
.use(Terminal)
77-
.mount('#app')
79+
80+
app.use(createTerminal())
81+
82+
app.mount('#app')
7883
```
7984

8085
使用示例

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-web-terminal",
3-
"version": "3.3.4-rc.8",
3+
"version": "3.4.0",
44
"description": "A beautiful web-side command line window plugin (native simulation). 一个漂亮的网页命令行插件(原生模拟)",
55
"license": "Apache-2.0",
66
"private": false,

src/common/api/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {TerminalApi, TerminalApiData, TerminalApiListenerFunc, TerminalConfiguration} from "~/types";
2+
import {_isEmpty} from "~/common/util.ts";
23

34
const data: TerminalApiData = {
45
pool: {},
@@ -44,13 +45,16 @@ export function configTheme(theme: string, css: string) {
4445
}
4546

4647
export function configStoreName(name: string) {
48+
if (_isEmpty(name)) {
49+
throw new Error("The terminal storage name is invalid: " + name)
50+
}
4751
data.configuration.storeName = name
4852
console.debug("Configured storeName", name)
4953
}
5054

5155
export function configMaxStoredCommandCountPerInstance(count: number) {
5256
if (count <= 1) {
53-
throw new Error("The value of 'maxStoredLogCountPerInstance' must be a valid positive number")
57+
throw new Error("The value of 'maxStoredLogCountPerInstance' must be a valid positive number: " + count)
5458
}
5559
data.configuration.maxStoredCommandCountPerInstance = count
5660
console.debug("Configured maxStoredCommandCountPerInstance", count)

0 commit comments

Comments
 (0)