yn-ui
v1.0.8
Published
A Vue Component Demo!
Downloads
3
Readme
component
Vue component封装测试
Build Setup
安装
npm i yn-ui
引入
// main.js
import Vue from 'vue'
import App from './App.vue'
import demoUI from 'yn-ui'
Vue.use(demoUI)
new Vue({
el: '#app',
render: h => h(App)
})
使用
// app.vue
<template>
<div id="app">
<yn-side-layout :isShow="flg" @maskClick="maskClick">
<div slot="sideLeftMenu">left menu</div>
<div slot="sideContent">
<i class="fa fa-list header-fa" @click="maskClick"> 侧滑案例演示</i>
<yn-menu-nav :options="options" @menuNavChange="menuNavChange"></yn-menu-nav>
<img src="./assets/logo.png">
<yn-bottom-nav :option="options1" v-on:footerNavChange="footerNavChange"></yn-bottom-nav>
</div>
</yn-side-layout>
</div>
</template>
<script>
export default {
name: 'app',
data () {
return {
flg: false,
options: {
style: {
fontSize: '.8rem',
color: '#999',
activeColor: '#000',
lineHeight: '2rem'
},
list: [
{name: '统计', to: '/msg/main'},
{name: '最新', to: '/msg/new'},
{name: '待办', to: '/msg/wait'}
]
},
options1: {
index: 0,
list: [
{id: 0, name: '消息', icon: 'fa-commenting'},
{id: 1, name: '日程', icon: 'fa-calendar'},
{id: 2, name: '通讯录', icon: 'fa-address-book-o'},
{id: 3, name: '应用', icon: 'fa-th-list'}
]
}
}
},
methods: {
maskClick () {
this.flg = !this.flg
},
menuNavChange (idx) {
console.log(`设计时为了尽量让组件解耦,所有组件都不进行跳转等操作。这些操作请在此回调函数中完成。`)
console.log(`PS: 点击事件回调返回传入的list 下标 , 当前index为: ${idx}`)
},
footerNavChange (idx) {
console.log(`设计时为了尽量让组件解耦,所有组件都不进行跳转等操作。这些操作请在此回调函数中完成。`)
console.log(`PS: 点击事件回调返回传入的list 下标 , 当前index为: ${idx}`)
}
}
}
</script>
<style lang="scss">
.header-fa {
margin: 1rem;
}
</style>