Vue:不同页面之间的共享数据

vue.js Vue.js

卡卡西

2020-05-28

var app = new Vue({
    el: '#app',
    data: {
        sharedData : ""
    },

    methods: {
        goToPageB: function() {
             if (some condition is met) {
                window.location.href="pageB.html";
                sharedData = 1234;  <------- I want to access sharedData in page B as well
             } 

        } 
    }

我是Vue的新手,我制作了一个虚拟登录页面,并尝试根据用户名使主页显示sharedData。但是,在我的应用程序定向到B页之后,数据始终会丢失。如何解决此问题?

第4232篇《Vue:不同页面之间的共享数据》来自Winter(https://github.com/aiyld/aiyld.github.io)的站点

0个回答

问题类别

JavaScript Ckeditor Python Webpack TypeScript Vue.js React.js ExpressJS KoaJS CSS Node.js HTML Django 单元测试 PHP Asp.net jQuery Bootstrap IOS Android