import Vue from 'vue'
import components from 'vue-ncu-unit'
new Vue({
el: '#app',
components: {
college: components.College,
degree: components.Degree,
department: components.Department,
grade: components.Grade,
trans: components.Trans
}
// or in es2015...
components
})
<college defaults="工學院"></college>
<department defaults="32060"
:filtering="{
college: '工學院',
degree: '碩士班'
}"></department>
<degree defaults="碩士班"></degree>
<degree defaults="碩士班" id="demo-degree"></degree>
<grade degree="碩士班"
defaults="3"
listen-to-degree="demo-degree"></grade>
import { bus, events } from '../'
let event = events.changeDegree.withID('demo-degree')
// event = 'changeDegree:demo-degree'
bus.$on(event, function (data) {
document.getElementById('demoCallback').textContent = data.degree.id
})
<department defaults="32060"
:filtering="{
college: '工學院',
degree: '碩士班'
}"
:except="[32010, 32020, 32030, 32040]"></department>
<department defaults="32060"
:filtering="{
college: '工學院',
degree: '碩士班'
}"
:only="[32060, 32080, 32090]">
<degree id="demo-degree"></degree>
<college id="demo-college"></college>
<department listen-to-degree="demo-degree"
listen-to-college="demo-college"</department>
.ncu-unit {
font-weight: 700;
}
.ncu-unit--degree {
background-color: lightskyblue;
color: dimgrey;
}
.ncu-unit--college {
background-color: red;
color: white;
}
.ncu-unit--department {
background-color: yellow;
color: brown;
}
.ncu-unit--grade {
background-color: limegreen;
color: purple;
}
<degree defaults="博士班" locale="en"></degree>
<college defaults="工學院" locale="en"></college>
<department locale="en"
defaults="34060"
:filtering="{
college: '工學院',
degree: '博士班'
}"
</department>
<grade degree="博士班" defaults="3" locale="en"</grade>
<trans type="degree" trans-id="博士班"></trans>
<trans type="degree" trans-id="博士班" locale="en"></trans>
<trans type="college" trans-id="工學院"></trans>
<trans type="college" trans-id="工學院" locale="en"></trans>
<trans type="department" trans-id="34060"></trans>
<trans type="department" trans-id="34060" locale="en"></trans>
props | 預設值 | 說明 |
---|---|---|
defaults | 學士班 |
第一筆資料 |
id | ncu-unit--degree |
|
class | ncu-unit ncu-unit--degree |
|
name | degree |
props | 預設值 | 說明 |
---|---|---|
defaults | 中心、處室 |
第一筆資料 |
id | ncu-unit--college |
|
class | ncu-unit ncu-unit--college |
|
name | college |
props | 預設值 | 說明 |
---|---|---|
defaults | 202 |
第一筆資料 |
id | ncu-unit--department |
|
class | ncu-unit ncu-unit--department |
|
name | department |
|
filtering | {
college: // 第一筆 college 的 id, |
篩選條件: college為學院資料的id degree為學位資料的id |
except | [] |
欲排除的系所 id 陣列 |
only | [] |
欲剩下的系所 id 陣列 |
listenToCollege | ncu-unit--college |
欲連動篩選的 college.vue id |
listenToDegree | ncu-unit--degree |
欲連動篩選的 degree.vue id |
props | 預設值 | 說明 |
---|---|---|
defaults | 1 |
|
id | ncu-unit--grade |
|
class | ncu-unit ncu-unit--grade |
|
name | grade |
|
degree | 第一筆 degree 的 id | 學位 |
listenToDegree | ncu-unit--degree |
欲篩選的 degree.vue id |
props | 預設值 | 說明 |
---|---|---|
id | ncu-unit--trans |
|
class | ncu-unit ncu-unit--trans |
|
type | N/A |
欲轉譯的類型需為degree college department 其中之一 必填 |
transId | N/A | 欲轉譯的ID |
如果要設定其他 attribute ,只需要按平常方式即可,例如<degree size="10" required></degree> |
---|