Skip to content

Instantly share code, notes, and snippets.

@theozaurus
Created May 21, 2019 15:29
Show Gist options
  • Save theozaurus/7a13df223772a4e9b3459d9017eb0079 to your computer and use it in GitHub Desktop.
Save theozaurus/7a13df223772a4e9b3459d9017eb0079 to your computer and use it in GitHub Desktop.
Support for apps loaded from Windows file shares
<html>
<head>
<title>Reproduction for Issue 2774</title>
<meta charset="utf-8">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-router@3.0.6/dist/vue-router.min.js"></script>
</head>
<body>
<h1><a href="https://github.com/vuejs/vue-router/pull/2774">Reproduction for Issue 2774</a></h1>
<h2>Instructions</h2>
<ol>
<li>Load file up using methods described below</li>
<li>If the code works then 'Test status: Test passed' will be displayed</li>
<li>Otherwise only 'Test status:' will be displayed</li>
</ol>
<h2>Test cases</h2>
<ul>
<li>Place file on a unix file system (e.g. 'file:///Users/theo/2774_example.html') - this will work</li>
<li>Host file using a webserver (e.g. 'http://localhost:8080/2774_example.html') - this will work</li>
<li>Host file on a windows filesystem (e.g. 'file:///C:/2774_example.html') - this will work</li>
<li>Host file on a windows filesystem (e.g. 'file://vboxsvr/share/2774_example.html') - this will <i>NOT</i> work</li>
</ul>
<p>
Test status:
<span id="app">Vue failed to load</span>
</p>
<script type="text/javascript">
const Passed = { template: '<span>Test passed</span>' };
const router = new VueRouter(
{
routes: [
{ path: '/', name: 'root', redirect: { name: 'home' } },
{ path: '/home', name: 'home', component: Passed }
],
scrollBehavior: (to, from, savedPosition) => {
if (savedPosition) {
return savedPosition
} else {
return { x: 0, y: 0 }
}
}
}
);
Vue.use(VueRouter);
new Vue({
template: '<router-view></router-view>',
router: router
}).$mount('#app');
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment