From 75beb10730bb07617dec2d8028a814b70257475d Mon Sep 17 00:00:00 2001 From: dolymood Date: Mon, 27 Nov 2017 11:19:33 +0800 Subject: [PATCH] remove $api object, for issue #31 --- src/common/helpers/create-api.js | 2 -- test/unit/specs/dialog.spec.js | 3 ++- test/unit/specs/toast.spec.js | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/helpers/create-api.js b/src/common/helpers/create-api.js index 22893ed5..8c7a3f95 100644 --- a/src/common/helpers/create-api.js +++ b/src/common/helpers/create-api.js @@ -5,9 +5,7 @@ export default function createAPI (Vue, Component, events, single) { const api = createAPIComponent.apply(this, arguments) const name = Component.name const pureName = name.replace(/^cube-/i, '') - const apiName = `$${camelize(pureName)}` const createName = `$${camelize(`create-${pureName}`)}` - Vue.prototype[apiName] = api Vue.prototype[createName] = api.create return api } diff --git a/test/unit/specs/dialog.spec.js b/test/unit/specs/dialog.spec.js index 28e26b0f..67be73be 100644 --- a/test/unit/specs/dialog.spec.js +++ b/test/unit/specs/dialog.spec.js @@ -105,7 +105,8 @@ describe('Dialog', () => { template: '
xx
', methods: { showAPI() { - ins = this.$dialog.confirm({ + ins = this.$createDialog({ + type: 'confirm', showClose: true, title: 'dialog api title', content: 'dialog api content', diff --git a/test/unit/specs/toast.spec.js b/test/unit/specs/toast.spec.js index 567e04d6..98b3e5b3 100644 --- a/test/unit/specs/toast.spec.js +++ b/test/unit/specs/toast.spec.js @@ -89,7 +89,8 @@ describe('Toast', () => { txt: 'error txt', time: 200 }) - ins = this.$toast.warn({ + ins = this.$createToast({ + type: 'warn', txt: 'toast api content', time: 100 }) -- GitLab