Open wolichuang opened 3 years ago
1、hash 路由模式
使用 window.location.href 和 this.$router.push 或 replace
不管使用这三种方式的哪一种 store 都不会丢
2、history路由
this.router.replace store 不丢
window.location.href 页面刷新 store 丢
总结: 只有路由模式是history 且用location.href跳转路由的时候 store会丢
<div id="example">
<p>Original message: "{{ message }}"</p>
<p>Computed reversed message: "{{ reversedMessage }}"</p>
</div>
var vm = new Vue({
el: '#example',
data: {
message: 'Hello'
},
computed: {
// 计算属性的 getter
reversedMessage: function () {
// `this` 指向 vm 实例
return this.message.split('').reverse().join('')
}
}
})
// export { default as ScreenDialog } from './screen-dialog.vue';
const path = require('path');
const files = require.context('@/components/ControlMeeting', false, /\.vue$/);
const modules = {};
files.keys().forEach((key) => {
const name = path.basename(key, '.vue');
modules[name] = files(key).default || files(key);
});
export default {
components: modules
};
import * as modules from '@/components/ControlMeeting/index.js';
const {
CountDown,
CreateLivingDialog,
EndTimeDialog,
ScreenDialog,
SubTitleDialog
} = modules.default.components;
Vue.nextTick()
在修改数据之后立即使用这个方法,获取更新后的 DOM。所以放在Vue.nextTick()回调函数中的执行的应该是会对DOM进行操作的
Vue子组件调用父组件的方法
vue 监听路由变化
vue 下载