Step1 Components文件夹创建Link.vue
<template>
<div>
<el-link href="https://www.baidu.com" target="_blank">默认链接</el-link>
<el-link type="primary" href="https://www.baidu.com" target="_top">主要链接</el-link>
<el-link type="success" :underline="underlineFlg">成功链接</el-link>
<el-link type="warning" :underline=underlineFlg>警告链接</el-link>
<el-link type="danger" :underline="false">危险链接</el-link>
<el-link type="info" :underline=false disabled>信息链接</el-link>
</div>
</template>
<script>
export default {
name:"link",
data(){
return{
underlineFlg:false
}
}
}
</script>
<style scoped>
</style>
Step2 注册到路由index.js中
import Link from '../components/Link.vue'
Vue.use(Router)
export default new Router({
routes: [
{path: '/button', component: Button},
{path: '/link', component: Link}
]
})
Step3 在App.vue里给个入口
注意一个坑
false 可以这样写,不过有代码提示,直接输入:就好
<el-link type="danger" :underline="false">危险链接</el-link>
<el-link type="info" :underline=false>信息链接</el-link>