Skip to content

fix: Replace ES6 usage for IE11 compatibility #1500

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Feb 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,17 @@
},
vueComponents: {
'button-counter': {
template: `
<button @click="count += 1">
You clicked me {{ count }} times
</button>
`,
data() {
template:
'<button @click="count += 1">You clicked me {{ count }} times</button>',
data: function() {
return {
count: 0,
};
},
},
},
vueGlobalOptions: {
data() {
data: function() {
return {
count: 0,
message: 'Hello, World!',
Expand All @@ -139,7 +136,7 @@
};
},
computed: {
timeOfDay() {
timeOfDay: function() {
const date = new Date();
const hours = date.getHours();

Expand All @@ -160,7 +157,7 @@
},
vueMounts: {
'#counter': {
data() {
data: function() {
return {
count: 0,
};
Expand Down Expand Up @@ -195,7 +192,10 @@
if (vm.route.path === '/') {
return html;
}
return `${html}<br/> <i>Vercel</i> has given us a Pro account <br/> <a href="https://vercel.com/?utm_source=docsifyjsdocs" target="_blank"><img src="_media/vercel_logo.svg" alt="Vercel" width="100" height="64"></a>`;
return (
html +
'<br/> <i>Vercel</i> has given us a Pro account <br/> <a href="https://vercel.com/?utm_source=docsifyjsdocs" target="_blank"><img src="_media/vercel_logo.svg" alt="Vercel" width="100" height="64"></a>'
);
});
},
],
Expand Down
13 changes: 5 additions & 8 deletions src/core/render/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { callHook } from '../init/lifecycle';
import { getAndActive, sticky } from '../event/sidebar';
import { getPath, isAbsolutePath } from '../router/util';
import { isMobile, inBrowser } from '../util/env';
import { isPrimitive } from '../util/core';
import { isPrimitive, merge } from '../util/core';
import { scrollActiveSidebar } from '../event/scroll';
import { Compiler } from './compiler';
import * as tpl from './tpl';
Expand Down Expand Up @@ -116,10 +116,10 @@ function renderMain(html) {

// vueMounts
vueMountData.push(
...Object.entries(docsifyConfig.vueMounts || {})
.map(([cssSelector, vueConfig]) => [
...Object.keys(docsifyConfig.vueMounts || {})
.map(cssSelector => [
dom.find(markdownElm, cssSelector),
vueConfig,
docsifyConfig.vueMounts[cssSelector],
])
.filter(([elm, vueConfig]) => elm)
);
Expand Down Expand Up @@ -169,10 +169,7 @@ function renderMain(html) {
})
.map(elm => {
// Clone global configuration
const vueConfig = Object.assign(
{},
docsifyConfig.vueGlobalOptions || {}
);
const vueConfig = merge({}, docsifyConfig.vueGlobalOptions || {});

// Replace vueGlobalOptions data() return value with shared data object.
// This provides a global store for all Vue instances that receive
Expand Down