vue-router

VueJS - DOMException: “The operation is insecure.”

百般思念 提交于 2021-02-10 23:42:02
问题 I am getting DOMException: "The operation is insecure." error in the console from my website (using Vue). It only happens when it's hosted on github pages but it it doesn't error when it's being run locally. Github page url: https://cubxity.github.io/ks/#/display/2227?scopes=&displayTime=true My browser is Firefox, build id: 20181206201918 回答1: TL;DR: This isn't a Vue issue: you cannot programmatically alter the contents of a form input through the DOM. Input file fields are more rigorously

VueJS - DOMException: “The operation is insecure.”

做~自己de王妃 提交于 2021-02-10 23:41:04
问题 I am getting DOMException: "The operation is insecure." error in the console from my website (using Vue). It only happens when it's hosted on github pages but it it doesn't error when it's being run locally. Github page url: https://cubxity.github.io/ks/#/display/2227?scopes=&displayTime=true My browser is Firefox, build id: 20181206201918 回答1: TL;DR: This isn't a Vue issue: you cannot programmatically alter the contents of a form input through the DOM. Input file fields are more rigorously

How to test vue router beforeRouteUpdate navigation guard?

一笑奈何 提交于 2021-02-10 14:32:23
问题 First off, I'm using Vue-property-decorator. My component has a component route, defined like this. @Component({ components: { ComponentA, ComponentB }, beforeRouteUpdate (to, _from, next) { const { checkInDate, checkOutDate, items, currency, locale } = to.query; const queryFullfilled = !!checkInDate && !!checkOutDate && !!items.length && !!currency && !!locale; if ([BOOKING_PAGE, RESERVATION_PAGE].indexOf(to.name) > -1 && queryFullfilled) { this.validateRooms(); } next(); } }) export default

How to test vue router beforeRouteUpdate navigation guard?

旧时模样 提交于 2021-02-10 14:32:07
问题 First off, I'm using Vue-property-decorator. My component has a component route, defined like this. @Component({ components: { ComponentA, ComponentB }, beforeRouteUpdate (to, _from, next) { const { checkInDate, checkOutDate, items, currency, locale } = to.query; const queryFullfilled = !!checkInDate && !!checkOutDate && !!items.length && !!currency && !!locale; if ([BOOKING_PAGE, RESERVATION_PAGE].indexOf(to.name) > -1 && queryFullfilled) { this.validateRooms(); } next(); } }) export default

vite2 vue3-ts 添加router, vuex和alias

旧街凉风 提交于 2021-02-08 23:36:34
原文链接: vite2 vue3-ts 添加router, vuex和alias 安装 yarn add vue-router@4 yarn add vuex@next https://next.vuex.vuejs.org/installation.html https://github.com/vuejs/vue-router-next https://next.router.vuejs.org/ https://next.vuex.vuejs.org/installation.html vuex store import { createStore } from "vuex"; const defaultState = { count: 0, }; const store = createStore({ state() { return defaultState; }, mutations: { increment(state: typeof defaultState) { state.count++; }, }, getters: { double(state: typeof defaultState) { return 2 * state.count; }, }, }); export default store; app.vue <template> <el

Vue自定义指令和路由

别说谁变了你拦得住时间么 提交于 2021-02-07 00:28:44
一、自定义指令   除了默认设置的核心指令( v-model 和 v-show ), Vue 也允许注册自定义指令。   下面我们注册一个全局指令 v-focus,该指令的功能是在页面加载时,元素获得焦点: <div id= " app " > <p>页面载入时,input 元素自动获取焦点:</p> <input v-focus> </div> <script> // 注册一个全局自定义指令 v-focus Vue.directive ( ' focus ' , { // 当绑定元素插入到 DOM 中。 inserted: function (el) { // 聚焦元素 el.focus() } }) // 创建根实例 new Vue({ el: ' #app ' }) </script>   用 directives 选项来注册局部指令,这样指令只能在这个实例中使用 <div id= " app " > <p>页面载入时,input 元素自动获取焦点:</p> <input v-focus> </div> <script> // 创建根实例 new Vue({ el: ' #app ' , directives : { // 注册一个局部的自定义指令 v-focus focus: { // 指令的定义 inserted: function (el) { // 聚焦元素 el

Vue Router History Mode with PWA in Offline Mode

不想你离开。 提交于 2021-02-06 03:53:44
问题 To get history mode working with Vue-Router you need to return the contents of your main page when trying to access a route that doesn't exist. For example when you visit mypwa.com/route1 your server checks if there is a resource at route1 and if there isn't, it returns the contents that is found at mypwa.com/ (but without redirecting you). This is great and works when you're online, but it requires your server to do the actual re-routing. If you have a PWA that's meant to work offline, you

Vue Router History Mode with PWA in Offline Mode

我们两清 提交于 2021-02-06 03:42:36
问题 To get history mode working with Vue-Router you need to return the contents of your main page when trying to access a route that doesn't exist. For example when you visit mypwa.com/route1 your server checks if there is a resource at route1 and if there isn't, it returns the contents that is found at mypwa.com/ (but without redirecting you). This is great and works when you're online, but it requires your server to do the actual re-routing. If you have a PWA that's meant to work offline, you

Vue Router Parameter Object Type Change On Browser Back Button

元气小坏坏 提交于 2021-02-05 11:46:52
问题 I am passing a parameter forum, which is an Object to a route in Vue.js (using vue-router) { path: '/forum/:forum', name: 'ForumView', component: ForumView, props: true } When i leave that specific forum route by using another link( to something like forum/post) on the page and after that try to go back to the form page using the back button in the browser I get the following error in the console Invalid prop: type check failed for prop "forum". Expected Object, got String with value "[object

Vue Router navigate or scroll to anchors (# anchors)

前提是你 提交于 2021-02-05 11:42:02
问题 I am struggling with vue-router not scrolling/navigating to anchor tags (ex: #anchor ). I have read various solutions here on Stack Overflow, but none have worked so far. Please find below the code I am using right now, which is not working: main.js const router = createRouter({ history: createWebHistory(), routes: [ { path: "/docs/1.0/:title", component: Content, name: "docs" } ], scrollBehavior(to, from, savedPosition) { if (savedPosition) { return savedPosition; } if (to.hash) { return {