【发布时间】:2021-03-07 18:45:16
【问题描述】:
我试图在用户单击导航栏按钮后生成一个空白页面。
我在 codepen 上的项目中导入了一个 Vue 路由器。
var demo = new Vue({
// A DOM element to mount our view model.
el: '#main',
// This is the model.
// Define properties and give them initial values.
data: {
active: 'what'
},
// Functions we will be using.
methods: {
makeActive: function(item){
// When a model is changed, the view will be automatically updated.
this.active = item;
}
}
});
当我点击导航栏中的 How 和 About 时,文本成功更改为
"You chose: How/about"
所以我知道导航栏代码正在工作。但我想生成一个全新的页面。
当我单击“如何”或“关于”时,我希望首页文本完全消失,并为用户显示一个新页面。如何让标题页文字消失,并生成一个全新的黑色页面?
【问题讨论】: