update files

This commit is contained in:
nuintun 2015-11-24 10:56:47 +08:00
parent c955a294b9
commit 6e400799a1
2 changed files with 26 additions and 14 deletions

View File

@ -1,5 +1,5 @@
<div class="fn-left"> <div class="fn-left">
<a @click="popupToggle" title="添加项目" class="ui-project-add" href="javascript:;"> <a v-el:popup-trigger title="添加项目" class="ui-project-add" href="javascript:;">
<i class="icon-plus"></i> <i class="icon-plus"></i>
<i class="icon-expand"></i> <i class="icon-expand"></i>
</a> </a>
@ -10,7 +10,7 @@
<i class="icon-export"></i> <i class="icon-export"></i>
</a> </a>
</div> </div>
<div v-show="showPopup" class="ui-popup"> <div v-el:popup v-show="showPopup" class="ui-popup">
<div class="ui-popup-arrow"> <div class="ui-popup-arrow">
<em></em> <em></em>
<span></span> <span></span>
@ -19,10 +19,10 @@
<div v-show="submitError" class="ui-submit-tips">{{ submitError }}</div> <div v-show="submitError" class="ui-submit-tips">{{ submitError }}</div>
<form @submit.prevent="add" @focusin="focus"> <form @submit.prevent="add" @focusin="focus">
<ul> <ul>
<li is="project-base" :name.sync="name" :path.sync="path"></li> <li v-ref:base is="project-base" :name.sync="name" :path.sync="path"></li>
<li class="ui-popup-control"> <li class="ui-popup-control">
<input type="submit" class="ui-button" value="确定"/> <input type="submit" class="ui-button" value="确定"/>
<input @click="popupToggle" type="button" class="ui-button ui-button-orange" value="取消"/> <input @click.stop="hidePopup" type="button" class="ui-button ui-button-orange" value="取消"/>
</li> </li>
</ul> </ul>
</form> </form>

View File

@ -42,17 +42,14 @@ module.exports = Vue.component('app-configure', {
appConfigure: function (command, configure){ appConfigure: function (command, configure){
ipc.send('app-configure', command, configure); ipc.send('app-configure', command, configure);
}, },
popupToggle: function (){ hidePopup: function (){
this.showPopup = !this.showPopup; this.showPopup = false;
if (!this.showPopup) {
this.name = ''; this.name = '';
this.path = ''; this.path = '';
this.submitError = ''; this.submitError = '';
// clean error // clean error
this.$broadcast('reset-error'); this.$broadcast('reset-error');
}
}, },
add: function (){ add: function (){
this.$broadcast('submit'); this.$broadcast('submit');
@ -77,5 +74,20 @@ module.exports = Vue.component('app-configure', {
} }
} }
} }
},
created: function (){
var context = this;
document.addEventListener('click', function (event){
var target = event.target;
var popup = context.$els.popup;
var trigger = context.$els.popupTrigger;
if (trigger.contains(target) || popup.contains(target)) {
context.showPopup = true;
} else {
context.hidePopup();
}
});
} }
}); });