mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-25 03:26:34 +08:00
阶段性提交
This commit is contained in:
13
web/public/js/components/common/first-menu.js
Normal file
13
web/public/js/components/common/first-menu.js
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* 一级菜单
|
||||
*/
|
||||
Vue.component("first-menu", {
|
||||
template: ' \
|
||||
<div class="first-menu"> \
|
||||
<div class="ui menu text blue small">\
|
||||
<slot></slot>\
|
||||
</div> \
|
||||
<div class="ui divider"></div> \
|
||||
<div class="margin"></div> \
|
||||
</div>'
|
||||
});
|
||||
7
web/public/js/components/common/labeled-input.js
Normal file
7
web/public/js/components/common/labeled-input.js
Normal file
@@ -0,0 +1,7 @@
|
||||
Vue.component("labeled-input", {
|
||||
props: ["name", "size", "maxlength", "label", "value"],
|
||||
template: '<div class="ui input right labeled"> \
|
||||
<input type="text" :name="name" :size="size" :maxlength="maxlength" :value="value"/>\
|
||||
<span class="ui label">{{label}}</span>\
|
||||
</div>'
|
||||
});
|
||||
23
web/public/js/components/common/menu-item.js
Normal file
23
web/public/js/components/common/menu-item.js
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 菜单项
|
||||
*/
|
||||
Vue.component("menu-item", {
|
||||
props: ["href", "active", "code"],
|
||||
data: function () {
|
||||
var active = this.active;
|
||||
if (typeof(active) =="undefined") {
|
||||
var itemCode = "";
|
||||
if (typeof (window.TEA.ACTION.data.firstMenuItem) != "undefined") {
|
||||
itemCode = window.TEA.ACTION.data.firstMenuItem;
|
||||
}
|
||||
active = (itemCode == this.code);
|
||||
}
|
||||
return {
|
||||
vHref: (this.href == null) ? "" : this.href,
|
||||
vActive: active
|
||||
};
|
||||
},
|
||||
template: '\
|
||||
<a :href="vHref" class="item" :class="{active:vActive}"><slot></slot></a> \
|
||||
'
|
||||
});
|
||||
19
web/public/js/components/common/more-options-indicator.js
Normal file
19
web/public/js/components/common/more-options-indicator.js
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* 更多选项
|
||||
*/
|
||||
Vue.component("more-options-indicator", {
|
||||
data: function () {
|
||||
return {
|
||||
visible: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
changeVisible: function () {
|
||||
this.visible = !this.visible;
|
||||
if (Tea.Vue != null) {
|
||||
Tea.Vue.moreOptionsVisible = this.visible;
|
||||
}
|
||||
}
|
||||
},
|
||||
template: '<a href="" style="font-weight: normal" @click.prevent="changeVisible()">更多选项 <i class="icon angle" :class="{down:!visible, up:visible}"></i> </a>'
|
||||
});
|
||||
12
web/public/js/components/common/second-menu.js
Normal file
12
web/public/js/components/common/second-menu.js
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* 二级菜单
|
||||
*/
|
||||
Vue.component("second-menu", {
|
||||
template: ' \
|
||||
<div class="second-menu"> \
|
||||
<div class="ui menu text blue small">\
|
||||
<slot></slot>\
|
||||
</div> \
|
||||
<div class="ui divider"></div> \
|
||||
</div>'
|
||||
});
|
||||
6
web/public/js/components/common/submit-btn.js
Normal file
6
web/public/js/components/common/submit-btn.js
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 保存按钮
|
||||
*/
|
||||
Vue.component("submit-btn", {
|
||||
template: '<button class="ui button primary" type="submit"><slot>保存</slot></button>'
|
||||
});
|
||||
77
web/public/js/components/common/values-box.js
Normal file
77
web/public/js/components/common/values-box.js
Normal file
@@ -0,0 +1,77 @@
|
||||
Vue.component("values-box", {
|
||||
props: ["values", "size", "maxlength", "name"],
|
||||
data: function () {
|
||||
let values = this.values;
|
||||
if (typeof (values) != "object") {
|
||||
values = [];
|
||||
}
|
||||
return {
|
||||
"vValues": values,
|
||||
"isUpdating": false,
|
||||
"isAdding": false,
|
||||
"index": 0,
|
||||
"value": ""
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
create: function () {
|
||||
this.isAdding = true;
|
||||
var that = this;
|
||||
setTimeout(function () {
|
||||
that.$refs.value.focus();
|
||||
}, 200);
|
||||
},
|
||||
update: function (index) {
|
||||
this.cancel()
|
||||
this.isUpdating = true;
|
||||
this.index = index;
|
||||
this.value = this.vValues[index];
|
||||
var that = this;
|
||||
setTimeout(function () {
|
||||
that.$refs.value.focus();
|
||||
}, 200);
|
||||
},
|
||||
confirm: function () {
|
||||
if (this.isUpdating) {
|
||||
Vue.set(this.vValues, this.index, this.value);
|
||||
} else {
|
||||
this.vValues.push(this.value);
|
||||
}
|
||||
this.cancel();
|
||||
},
|
||||
remove: function (index) {
|
||||
this.vValues.$remove(index);
|
||||
},
|
||||
cancel: function () {
|
||||
this.isUpdating = false;
|
||||
this.isAdding = false;
|
||||
this.value = "";
|
||||
}
|
||||
},
|
||||
template: '<div>\
|
||||
<div style="margin-bottom: 1em" v-if="vValues.length > 0">\
|
||||
<div class="ui label tiny" v-for="(value, index) in vValues" style="margin-top:0.4em;margin-bottom:0.4em">{{value}}\
|
||||
<input type="hidden" :name="name" :value="value"/>\
|
||||
<a href="" @click.prevent="update(index)" title="修改"><i class="icon pencil small" ></i></a> \
|
||||
<a href="" @click.prevent="remove(index)" title="删除"><i class="icon remove"></i></a> \
|
||||
</div> \
|
||||
</div> \
|
||||
<!-- 添加|修改 -->\
|
||||
<div v-if="isAdding || isUpdating">\
|
||||
<div class="ui fields inline">\
|
||||
<div class="ui field">\
|
||||
<input type="text" :size="size" :maxlength="maxlength" v-model="value" ref="value" @keyup.enter="confirm()" @keypress.enter.prevent="1"/>\
|
||||
</div> \
|
||||
<div class="ui field">\
|
||||
<button class="ui button small" type="button" @click.prevent="confirm()">确定</button> \
|
||||
</div>\
|
||||
<div class="ui field">\
|
||||
<a href="" @click.prevent="cancel()">取消</a> \
|
||||
</div> \
|
||||
</div> \
|
||||
</div> \
|
||||
<div v-if="!isAdding && !isUpdating">\
|
||||
<button class="ui button small" type="button" @click.prevent="create()">+</button> \
|
||||
</div>\
|
||||
</div>'
|
||||
});
|
||||
Reference in New Issue
Block a user