如何在vue 3中的按钮单击上打开新页面?

Pypdeveloper

我的应用程序带有一个按钮,我想更改为另一个Vue文件。我的第一个Vue文件称为app.vue。

<template>
  <div id="app">
    <button id="gettingStarted">Getting started</button>
  </div>
</template>

<script>

export default {
  name: 'App',
  components: {

  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
#gettingStarted {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  background:cornflowerblue;
  border-radius: 0.5rem;
  height: 2.5rem;
  width: 6%;
}
</style>

然后我有另一个名为Gallery.vue的文件

<template>
  <div id="app">
      <h4>25%</h4>
    </div>
  </div>
</template>

<script>
export default {
  name: 'App',
  components: {
    
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>

因此,在按钮上单击in-app.vue我要转到gallery.vue。我目前正在为此项目使用Vue3。

您可以随时使用Vue路由器。

本教程将比我更好地解释:

https://appdividend.com/2018/12/28/vue-router-tutorial-with-example-how-to-use-routing-in-vuejs

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

刷新页面或单击“后退”按钮时如何防止表单重新提交

如何在Ionic 3(Ionic,Angular 5)上刷新页面

如何在Kotlin中选择菜单项上打开新页面?

如何通过单击按钮重定向到Angular 4中的新页面?

如何在TYPO3中按ID刷新或更新页面的缓存

在Netbeans Java应用程序上,如何通过单击按钮来打开新页面(而不是弹出窗口)?

如何使用关闭按钮在wxPython笔记本上生成新页面?

如何在Pupeteer中单击按钮以处理新页面?

如何在不刷新页面的情况下使用Vue切换按钮

如何在新页面中打开(单击后)react组件

如何创建一个可以打开新页面并带有返回上一页选项的按钮[ReactJS

单击反应中的按钮打开新页面

使用Server.Transfer保留页面URL,单击新页面上的按钮时如何保留URL?

如何刷新页面?(单击按钮关闭RadWindow)

如何在WordPress中访问新页面?

如何在Mechanize中刷新页面?

如何在UI事件之后检查刷新页面事件是否发生(例如,单击按钮)

如何在使用母版页的按钮单击上停止刷新页面

如何在我的JavaScript代码中包含刷新页面链接/按钮?

如何在MVC中刷新页面

如何在ActiveReports中创建新页面

每次单击按钮或链接时,如何使 html 文件包含自身而不刷新页面?

如何在 WKWebview 中制作按钮刷新页面

如何导航到 Gambas3 中的新页面

如何在新页面上单击按钮时显示数据库中的信息?

如何在flutter中向应用栏上的IconButton添加新页面?

如何防止在 React Native 功能中单击按钮时刷新页面

我如何设计这些卡片,以便在单击时打开指向新页面的链接?

CefSharp 如何将 JS 注入到 Windows.open 中打开的新页面中