Skip to content

Commit

Permalink
docs: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
cloydlau committed Jan 24, 2023
1 parent 95f4956 commit 632324a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ import { ref } from 'vue'
const JsonEditorVue = () => process.client
? import('json-editor-vue')
: Promise.resolve({ render: h => h('div') })
: Promise.resolve({ render: (h) => h('div') })
const value = ref()
</script>
Expand Down Expand Up @@ -638,7 +638,7 @@ export default {
components: {
JsonEditorVue: () => process.client
? import('json-editor-vue')
: Promise.resolve({ render: h => h('div') }),
: Promise.resolve({ render: (h) => h('div') }),
},
data() {
return {
Expand Down Expand Up @@ -828,13 +828,13 @@ module.exports = {

## Props

| Name | Description | Type | Default |
| ------- | --------------------------------------------------------------------------------------------- | ------------- | -------- |
| v-model | binding value | `any` | |
| mode | edit mode, <br>use `[v-model]:mode` in Vue 3 <br>or `:mode[.sync]` in Vue 2 | [Mode](#Mode) | `'tree'` |
| ... | properties of [svelte-jsoneditor](https://github.com/josdejong/svelte-jsoneditor/#properties) | | |
| Name | Description | Type | Default |
| ------------------------------------------------------ | --------------------------------------------------------------------------------------------- | ------------- | -------- |
| v-model /<br>modelValue (Vue 3) /<br>value (Vue 2) | binding value | any | |
| mode /<br>v-model:mode (Vue 3) /<br>:mode.sync (Vue 2) | edit mode | [Mode](#Mode) | `'tree'` |
| ... | properties of [svelte-jsoneditor](https://github.com/josdejong/svelte-jsoneditor/#properties) | | |

> ⚠ kebab-case is required for tag & prop name when using from CDN
> ⚠ kebab-case is required for tag & prop name when using from CDN.
### Binding value difference between svelte-jsoneditor and json-editor-vue

Expand All @@ -846,7 +846,7 @@ If you prefer the behavior of svelte-jsoneditor:
```html
<JsonEditorVue
:content="content"
:onChange="updatedContent => {
:onChange="(updatedContent) => {
content = updatedContent
}"
/>
Expand Down
22 changes: 11 additions & 11 deletions docs/README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ import { ref } from 'vue'
const JsonEditorVue = () => process.client
? import('json-editor-vue')
: Promise.resolve({ render: h => h('div') })
: Promise.resolve({ render: (h) => h('div') })
const value = ref()
</script>
Expand Down Expand Up @@ -638,7 +638,7 @@ export default {
components: {
JsonEditorVue: () => process.client
? import('json-editor-vue')
: Promise.resolve({ render: h => h('div') }),
: Promise.resolve({ render: (h) => h('div') }),
},
data() {
return {
Expand Down Expand Up @@ -828,11 +828,11 @@ module.exports = {

## 属性

| 名称 | 说明 | 类型 | 默认值 |
| ------- | -------------------------------------------------------------------------------------- | ------------- | -------- |
| v-model | 绑定值 | `any` | |
| mode | 编辑模式,<br>在 Vue 3 中使用 `[v-model]:mode`<br>Vue 2 中使用 `:mode[.sync]` | [Mode](#Mode) | `'tree'` |
| ... | [svelte-jsoneditor](https://github.com/josdejong/svelte-jsoneditor/#properties) 的参数 | | |
| 名称 | 说明 | 类型 | 默认值 |
| ------------------------------------------------------ | -------------------------------------------------------------------------------------- | ------------- | -------- |
| v-model /<br>modelValue (Vue 3) /<br>value (Vue 2) | 绑定值 | any | |
| mode /<br>v-model:mode (Vue 3) /<br>:mode.sync (Vue 2) | 编辑模式 | [Mode](#Mode) | `'tree'` |
| ... | [svelte-jsoneditor](https://github.com/josdejong/svelte-jsoneditor/#properties) 的属性 | | |

### svelte-jsoneditor 与 json-editor-vue 中绑定值的差异

Expand All @@ -844,23 +844,23 @@ module.exports = {
```html
<JsonEditorVue
:content="content"
:onChange="updatedContent => {
:onChange="(updatedContent) => {
content = updatedContent
}"
/>
```

> 详情见 https://github.com/josdejong/svelte-jsoneditor/pull/166。
### 布尔类型参数
### 布尔类型属性

仅写上 svelte-jsoneditor 的布尔类型参数如 `readOnly` 但不传值,会隐式转换为 `true`
仅写上 svelte-jsoneditor 的布尔类型属性如 `readOnly` 但不传值,会隐式转换为 `true`

- ✔️ `<JsonEditorVue readOnly />`

- ✔️ `<JsonEditorVue :readOnly="true" />`

> 通过 CDN 使用时,标签、prop 名称都必须使用短横线命名
> 通过 CDN 使用时,标签、属性名称都必须使用短横线命名。
<br>

Expand Down

0 comments on commit 632324a

Please sign in to comment.