提交 6fa3f048 authored 作者: 王鹏飞's avatar 王鹏飞

update

上级 2ce8f1c8
<template>
<header class="header">
<div class="logo"></div>
<div class="message"></div>
<div class="message">
<!-- <vue-message :option="{ source: 'MESSAGE_WEB' }" /> -->
</div>
</header>
</template>
<script>
import Message from '@/main'
import Message from '@/main.js'
export default {
mounted() {
new Message({ el: '.message', source: 'MESSAGE_WEB' })
Message({ container: '.message', source: 'MESSAGE_WEB' })
}
}
</script>
......
import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import App from './App.vue'
Vue.use(ElementUI)
// import VueMessage from '@/index.js'
// Vue.use(VueMessage, { source: 'MESSAGE_WEB' })
Vue.config.productionTip = false
new Vue({
render: h => h(App)
}).$mount('#app')
{
"name": "@ezijing/web-message-sdk",
"version": "0.1.2",
"version": "0.2.0",
"private": false,
"main": "dist/message.umd.min.js",
"main": "dist/message.umd.js",
"files": [
"dist/",
"package.json",
......
......@@ -6,11 +6,6 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="icon" href="<%= BASE_URL %>favicon.ico" />
<title><%= htmlWebpackPlugin.options.title %></title>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.12"></script>
<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css" />
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
</head>
<body>
<noscript>
......
......@@ -25,7 +25,7 @@
ref="message"
></message-popover>
</el-popover>
<el-dialog :visible.sync="visible" title="消息中心" :fullscreen="true">
<el-dialog :visible.sync="visible" title="消息中心" :fullscreen="true" :append-to-body="true">
<message v-if="visible" />
</el-dialog>
</div>
......@@ -36,6 +36,7 @@ import Message from '@/components/Message'
import MessagePopover from '@/components/MessagePopover'
import * as api from '@/api'
export default {
name: 'VueMessage',
components: { Message, MessagePopover },
data() {
return {
......
......@@ -48,7 +48,7 @@ export default {
getMessages() {
this.loading = true
api
.getMessages({ limit: 10, page: this.page, type: this.type, is_read: this.tabActive })
.getMessages({ limit: 10, page: this.page, type: this.type, is_read: this.tabActive, is_platform: 0 })
.then(response => {
this.messages = response.data
this.total = response.total
......
......@@ -26,8 +26,7 @@ export default {
},
methods: {
getMessages() {
const source = this.$option.source
api.getMessages({ limit: 4, type: 0, is_read: 0, source }).then(response => {
api.getMessages({ limit: 4, type: 0, is_read: 0, is_platform: 0 }).then(response => {
this.messages = response.data
})
},
......
import Vue from 'vue'
// import ElementUI from 'element-ui'
// import 'element-ui/lib/theme-chalk/index.css'
import App from './App.vue'
import Main from './Main.vue'
Vue.config.productionTip = false
let MessageConstructor = Vue.extend(Main)
export default class Message {
constructor(option = {}) {
window.messageOption = option
Vue.prototype.$option = option
if (!Message.instance) {
Message.renderDom(option)
Message.instance = this
}
return Message.instance
}
// 渲染vue
static renderDom(option) {
new Vue({
render: h => h(App)
}).$mount(option.el)
}
// 初始化
static init(option, cb) {
if (!this.instance) {
this.instance = new Message(option, cb)
}
return this.instance
}
const Message = function(options = { source: '' }) {
if (Vue.prototype.$isServer) return
const instance = new MessageConstructor({
data: options
})
window.messageOption = options
instance.$mount(options.container)
}
export default Message
......@@ -6,14 +6,11 @@ module.exports = {
index: { entry: 'examples/main.js' }
},
productionSourceMap: false,
runtimeCompiler: true,
css: {
extract: false
},
configureWebpack: {
externals: {
vue: 'Vue',
'element-ui': 'ElementUI'
},
output: {
libraryExport: 'default'
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论