feat(P4): precompute移植+app.js sources双向回填+回归1003/1003+验收体积/文件/data.json
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<template>
|
||||
<div class="aa-message-wrap">
|
||||
<div v-for="m in list" :key="m.id" class="aa-message" :class="'is-' + m.type">
|
||||
<span class="aa-message-icon">{{ icon(m.type) }}</span>
|
||||
<span class="aa-message-content">{{ m.content }}</span>
|
||||
<span v-if="m.closable !== false" class="aa-message-close" @click="close(m.id)">✕</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'AaMessagePro',
|
||||
props: { duration: { type: Number, default: 3000 } },
|
||||
data: function () { return { list: [], _id: 0 }; },
|
||||
methods: {
|
||||
icon: function (t) { return ({ success: '✓', error: '✕', warning: '!', info: 'i', loading: '…' })[t] || 'i'; },
|
||||
open: function (opts) {
|
||||
var id = ++this._id;
|
||||
var item = { id: id, type: opts.type || 'info', content: opts.content, closable: opts.closable };
|
||||
this.list.push(item);
|
||||
var d = opts.duration == null ? this.duration : opts.duration;
|
||||
if (d > 0) { var self = this; setTimeout(function () { self.close(id); }, d); }
|
||||
return id;
|
||||
},
|
||||
close: function (id) { this.list = this.list.filter(function (m) { return m.id !== id; }); },
|
||||
success: function (c, d) { return this.open({ type: 'success', content: c, duration: d }); },
|
||||
error: function (c, d) { return this.open({ type: 'error', content: c, duration: d }); },
|
||||
warning: function (c, d) { return this.open({ type: 'warning', content: c, duration: d }); },
|
||||
info: function (c, d) { return this.open({ type: 'info', content: c, duration: d }); },
|
||||
loading: function (c, d) { return this.open({ type: 'loading', content: c, duration: d }); }
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style src="./MessagePro.css"></style>
|
||||
Reference in New Issue
Block a user