From e8e1677b47576ae728ff0d77a8e3d229f2fb7624 Mon Sep 17 00:00:00 2001 From: Aresn Date: Thu, 1 Jun 2017 10:48:03 +0800 Subject: [PATCH] Message & Notice support SSR --- build/webpack.dev.config.js | 3 +- examples/routers/notice.vue | 43 +++++++++++++++++------ src/components/base/notification/index.js | 19 +++++----- 3 files changed, 46 insertions(+), 19 deletions(-) diff --git a/build/webpack.dev.config.js b/build/webpack.dev.config.js index 5803c51e..8c07d166 100644 --- a/build/webpack.dev.config.js +++ b/build/webpack.dev.config.js @@ -27,7 +27,8 @@ module.exports = merge(webpackBaseConfig, { resolve: { alias: { iview: '../../src/index', - vue: 'vue/dist/vue.js' + // vue: 'vue/dist/vue.js' + vue: 'vue/dist/vue.runtime.js' } }, plugins: [ diff --git a/examples/routers/notice.vue b/examples/routers/notice.vue index aa0f4e0b..d1a76c58 100644 --- a/examples/routers/notice.vue +++ b/examples/routers/notice.vue @@ -1,21 +1,44 @@ diff --git a/src/components/base/notification/index.js b/src/components/base/notification/index.js index 7ab2c625..794bac56 100644 --- a/src/components/base/notification/index.js +++ b/src/components/base/notification/index.js @@ -10,15 +10,18 @@ Notification.newInstance = properties => { props += ' :' + camelcaseToHyphen(prop) + '=' + prop; }); - const div = document.createElement('div'); - div.innerHTML = ``; - document.body.appendChild(div); - - const notification = new Vue({ - el: div, + const Instance = new Vue({ data: _props, - components: { Notification } - }).$children[0]; + render (h) { + return h(Notification, { + props: _props + }) + } + }); + + const component = Instance.$mount(); + document.body.appendChild(component.$el); + const notification = Instance.$children[0]; return { notice (noticeProps) {