vue-button

Repository

https://github.com/livelybone/vue-button

Example

Code


VueLoading -> @livelybone/vue-loading. You can custom your loading content

new Vue({
el: '#module',
template: '<vue-btn :clickFn="submit" :errorFn="error">\n' +
' 提交\n' +
' <loading class="loading" slot="lock" size=".2rem" color="#fff"/>\n' +
' </vue-btn>',
data: function () {
return {}
},
methods: {
submit: function () {
return new Promise(function (res, rej) {
setTimeout(function () {
res(1)
/*rej(new Error('提交失败!'))*/
}, 2000)
}).then(function () {
alert('提交成功')
})
},
error: function (e) {
alert(e)
}
},
components: { 'vue-btn': VueBtn, 'loading': VueLoading }
})