npm intall mint-ui --save
import MintUI from 'mint-ui'import 'mint-ui/lib/style.css'Vue.use(MintUI)
<mt-header fixed title="固定在顶部"></mt-header>
npm intall mint-ui --save
npm install babel-plugin-component -D
注:借助 babel-plugin-component,我们可以只引入需要的组件,以达到减小项目体积的目的。
"plugins": [["component", [{"libraryName": "mint-ui","style": true}]]]
// 按需导入 Mint-UI 中的组件import { Header } from 'mint-ui'Vue.component(Header.name, Header)
<mt-header fixed title="固定在顶部"></mt-header>
data () {return {selected:'',img1:require('../assets/images/icon/shouye1.png'),// img2:require('../assets/images/icon/wode.png')img2:'../assets/images/icon/wode.png'};},
跳转到指定的URL,在history栈中添加一个记录,点击后退会返回上一个页面
push 后面可以是对象,也可以是字符串:
// 字符串this.$router.push('/home/first')// 对象this.$router.push({ path: '/home/first' })// 命名的路由this.$router.push({ name: 'home', params: { userId: wise }})
浏览器在解析时,将它解析成一个类似于a标签。
<li ><router-link to="/home/first">点击验证动画效果 </router-link></li>
跳转到指定的url,不会向history里面添加新的记录,点击返回,会跳转到上上一个页面。上一个记录是不存在的。
replace后面可以是对象,也可以是字符串:
// 字符串this.$router.replace('/home/first')// 对象this.$router.replace({ path: '/home/first' })// 命名的路由this.$router.replace({ name: 'home', params: { userId: wise }})
相对于当前页面向前或向后跳转多少个页面,类似 window.history.go(n)。n可为正数可为负数。正数返回上一个页面
this. $router.go(1) //前进一步 相当于history.forward()this. $router.go(-1) //后退一步 相当于history.back()this. $router.go(10)
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号