Skip to content

Commit 727ee8f

Browse files
committed
Rename vueMountOptions to vueMounts
1 parent 52cce02 commit 727ee8f

File tree

5 files changed

+30
-38
lines changed

5 files changed

+30
-38
lines changed

docs/configuration.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ window.$docsify = {
667667

668668
- type: `Object`
669669

670-
Specifies Vue options to be shared throughout your site. These options will be used when Docsify detects Vue content in the main content area that has not been previously mounted via [vueMountOptions](#vuemountoptions), [vueComponents](#vuecomponents), or a markdown `<script>`.
670+
Specifies Vue options to be shared throughout your site. These options will be used when Docsify detects Vue content in the main content area that has not been previously mounted via [vueMounts](#vuemounts), [vueComponents](#vuecomponents), or a markdown `<script>`.
671671

672672
```js
673673
window.$docsify = {
@@ -697,15 +697,15 @@ window.$docsify = {
697697
</p>
698698
</output>
699699

700-
## vueMountOptions
700+
## vueMounts
701701

702702
- type: `Object`
703703

704-
Specifies Vue mount elements and their associated options. Mount elements are specified using a [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) as the key with an object containing Vue options as their value. Docsify will mount the first matching element in the main content area (`#main, .markdown-section`) each time a new page is loaded.
704+
Specifies DOM elements to mount as Vue instances and their associated options. Mount elements are specified using a [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) as the key with an object containing Vue options as their value. Docsify will mount the first matching element in the main content area each time a new page is loaded.
705705

706706
```js
707707
window.$docsify = {
708-
vueMountOptions: {
708+
vueMounts: {
709709
'#counter': {
710710
data() {
711711
return {

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
},
149149
},
150150
},
151-
vueMountOptions: {
151+
vueMounts: {
152152
'#counter': {
153153
data() {
154154
return {

docs/vue.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ To get started, add Vue [2.x](https://vuejs.org) or [3.x](https://v3.vuejs.org)
2626

2727
## Template syntax
2828

29-
Vue [template syntax](https://vuejs.org/v2/guide/syntax.html) is used to create dynamic content. With no additinal configuration, this syntax offers several useful features like support for [JavaScript expressions](https://vuejs.org/v2/guide/syntax.html#Using-JavaScript-Expressions) and Vue [directives](https://vuejs.org/v2/guide/syntax.html#Directives) for loops and conditional rendering.
29+
Vue [template syntax](https://vuejs.org/v2/guide/syntax.html) is used to create dynamic content. With no additional configuration, this syntax offers several useful features like support for [JavaScript expressions](https://vuejs.org/v2/guide/syntax.html#Using-JavaScript-Expressions) and Vue [directives](https://vuejs.org/v2/guide/syntax.html#Directives) for loops and conditional rendering.
3030

3131
```markdown
3232
<!-- Hide in docsify, show elsewhere (e.g. GitHub) -->
@@ -53,7 +53,7 @@ Vue [template syntax](https://vuejs.org/v2/guide/syntax.html) is used to create
5353

5454
[View output on GitHub](https://github.com/docsifyjs/docsify/blob/develop/docs/vue.md#template-syntax)
5555

56-
Vue content becomes more interesting when [data](#data), [computed properties](#computed-properties), [methods](#methods), and [lifecycle hooks](#lifecycle-hooks) are used. These options can be specified as [global options](#global-options), [mount options](#mount-options), or within [components](#components).
56+
Vue content becomes more interesting when [data](#data), [computed properties](#computed-properties), [methods](#methods), and [lifecycle hooks](#lifecycle-hooks) are used. These options can be specified as [global options](#global-options) or, when [mounting DOM elements](#mounting-dom-elements), or within Vue [components](#components).
5757

5858
### Data
5959

@@ -189,7 +189,7 @@ Good {{ timeOfDay }}!
189189

190190
## Global options
191191

192-
Use `vueGlobalOptions` to share Vue options throughout your site. These options will be used when Docsify detects Vue content in the main content area that has not been previously mounted via [mount options](#mount-options), [components](#components), or a [markdown script](#markdown-script).
192+
Use `vueGlobalOptions` to share Vue options throughout your site. These options will be used when Docsify detects Vue content in the main content area that has not already been mounted with [vueMounts](#mounting-dom-elements), [vueComponents](#components), or a [markdown script](#markdown-script).
193193

194194
```js
195195
window.$docsify = {
@@ -231,13 +231,13 @@ Notice the behavior when multiple global counters are rendered:
231231

232232
Changes made to one counter affect the both counters. This is because both instances reference the same global `count` value. Now, navigate to a new page and return to this section to see how changes made to global data persist between page loads.
233233

234-
## Mount options
234+
## Mounting DOM elements
235235

236-
Use `vueMountOptions` to specify Vue mount elements and their associated options. Mount elements are specified using a [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) as the key with an object containing Vue options as their value. Docsify will mount the first matching element in the main content area (`#main, .markdown-section`) each time a new page is loaded.
236+
Use `vueMounts` to specify DOM elements to mount as Vue instances and their associated options. Mount elements are specified using a [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) as the key with an object containing Vue options as their value. Docsify will mount the first matching element in the main content area each time a new page is loaded.
237237

238238
```js
239239
window.$docsify = {
240-
vueMountOptions: {
240+
vueMounts: {
241241
'#counter': {
242242
data() {
243243
return {
@@ -325,7 +325,7 @@ Vue content can mounted using a `<script>` tag in your markdown pages.
325325

326326
- Docsify processes Vue content in the following order:
327327
1. Markdown `<script>`
328-
1. `vueMountOptions`
328+
1. `vueMounts`
329329
1. `vueGlobalOptions`
330330
- Docsify will not mount an existing Vue instance or an element that contains an existing Vue instance.
331331
- Docsify will automatically destroy/unmount all Vue instances it creates before new page content is loaded.

src/core/render/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ function renderMain(html) {
114114
vueGlobalData = docsifyConfig.vueGlobalOptions.data();
115115
}
116116

117-
// vueMountOptions
117+
// vueMounts
118118
vueMountData.push(
119-
...Object.entries(docsifyConfig.vueMountOptions || {})
119+
...Object.entries(docsifyConfig.vueMounts || {})
120120
.map(([cssSelector, vueConfig]) => [
121121
dom.find(markdownElm, cssSelector),
122122
vueConfig,

test/e2e/vue.test.js

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ describe('Vue.js Compatibility', function() {
3030
};
3131
},
3232
},
33-
vueMountOptions: {
34-
'#vuemountoptions': {
33+
vueMounts: {
34+
'#vuemounts': {
3535
data: function() {
3636
return {
3737
counter: 0,
38-
msg: 'vuemountoptions',
38+
msg: 'vuemounts',
3939
};
4040
},
4141
},
@@ -53,7 +53,7 @@ describe('Vue.js Compatibility', function() {
5353
<span>{{ counter }}<span>
5454
</div>
5555
56-
<div id="vuemountoptions">
56+
<div id="vuemounts">
5757
<p v-text="msg">---</p>
5858
<button v-on:click="counter += 1">+</button>
5959
<span>{{ counter }}<span>
@@ -114,11 +114,8 @@ describe('Vue.js Compatibility', function() {
114114
'vueglobaloptions'
115115
);
116116
await expect(page).toEqualText('#vueglobaloptions span', '0');
117-
await expect(page).toEqualText(
118-
'#vuemountoptions p',
119-
'vuemountoptions'
120-
);
121-
await expect(page).toEqualText('#vuemountoptions span', '0');
117+
await expect(page).toEqualText('#vuemounts p', 'vuemounts');
118+
await expect(page).toEqualText('#vuemounts span', '0');
122119
await expect(page).toEqualText('#vuescript p', 'vuescript');
123120
await expect(page).toEqualText('#vuescript span', '0');
124121

@@ -127,8 +124,8 @@ describe('Vue.js Compatibility', function() {
127124
await expect(page).toEqualText('#vuecomponent', '1');
128125
await page.click('#vueglobaloptions button');
129126
await expect(page).toEqualText('#vueglobaloptions span', '1');
130-
await page.click('#vuemountoptions button');
131-
await expect(page).toEqualText('#vuemountoptions span', '1');
127+
await page.click('#vuemounts button');
128+
await expect(page).toEqualText('#vuemounts span', '1');
132129
await page.click('#vuescript button');
133130
await expect(page).toEqualText('#vuescript span', '1');
134131
});
@@ -144,23 +141,23 @@ describe('Vue.js Compatibility', function() {
144141
await expect(page).toEqualText('#vuefor', '{{ i }}');
145142
await expect(page).toEqualText('#vuecomponent', '---');
146143
await expect(page).toEqualText('#vueglobaloptions p', '---');
147-
await expect(page).toEqualText('#vuemountoptions p', '---');
144+
await expect(page).toEqualText('#vuemounts p', '---');
148145
await expect(page).toEqualText('#vuescript p', '---');
149146
});
150147

151-
test(`ignores content when vueComponents, vueMountOptions, and vueGlobalOptions are undefined`, async () => {
148+
test(`ignores content when vueComponents, vueMounts, and vueGlobalOptions are undefined`, async () => {
152149
const docsifyInitConfig = getSharedConfig();
153150

154151
docsifyInitConfig.config.vueComponents = undefined;
155152
docsifyInitConfig.config.vueGlobalOptions = undefined;
156-
docsifyInitConfig.config.vueMountOptions = undefined;
153+
docsifyInitConfig.config.vueMounts = undefined;
157154
docsifyInitConfig.scriptURLs = vueURL;
158155

159156
await docsifyInit(docsifyInitConfig);
160157
await expect(page).toEqualText('#vuefor', '{{ i }}');
161158
await expect(page).toEqualText('#vuecomponent', '---');
162159
await expect(page).toEqualText('#vueglobaloptions p', '---');
163-
await expect(page).toEqualText('#vuemountoptions p', '---');
160+
await expect(page).toEqualText('#vuemounts p', '---');
164161
await expect(page).toEqualText('#vuescript p', 'vuescript');
165162
});
166163

@@ -174,16 +171,14 @@ describe('Vue.js Compatibility', function() {
174171
await expect(page).toEqualText('#vuefor', '12345');
175172
await expect(page).toEqualText('#vuecomponent', '0');
176173
expect(await page.innerText('#vueglobaloptions p')).toBe('');
177-
await expect(page).toEqualText('#vuemountoptions p', 'vuemountoptions');
174+
await expect(page).toEqualText('#vuemounts p', 'vuemounts');
178175
await expect(page).toEqualText('#vuescript p', 'vuescript');
179176
});
180177

181-
test(`ignores content when vueMountOptions is undefined`, async () => {
178+
test(`ignores content when vueMounts is undefined`, async () => {
182179
const docsifyInitConfig = getSharedConfig();
183180

184-
docsifyInitConfig.config.vueMountOptions[
185-
'#vuemountoptions'
186-
] = undefined;
181+
docsifyInitConfig.config.vueMounts['#vuemounts'] = undefined;
187182
docsifyInitConfig.scriptURLs = vueURL;
188183

189184
await docsifyInit(docsifyInitConfig);
@@ -193,10 +188,7 @@ describe('Vue.js Compatibility', function() {
193188
'#vueglobaloptions p',
194189
'vueglobaloptions'
195190
);
196-
await expect(page).toEqualText(
197-
'#vuemountoptions p',
198-
'vueglobaloptions'
199-
);
191+
await expect(page).toEqualText('#vuemounts p', 'vueglobaloptions');
200192
await expect(page).toEqualText('#vuescript p', 'vuescript');
201193
});
202194

0 commit comments

Comments
 (0)