From fd31801281079bf688715fba303b154ffc7fef40 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Thu, 25 Jan 2018 17:40:46 +0800 Subject: [PATCH] fix --- components/_util/vnode.js | 7 ++++--- components/button/button.vue | 8 ++------ components/icon/icon.vue | 15 +++++++++++++-- components/menu/src/MenuMixin.js | 2 +- .../tooltip/demo/arrow-point-at-center.vue | 18 ++++-------------- components/trigger/index.vue | 5 ++--- examples/components/demoBox.vue | 3 --- package.json | 2 -- webpack.base.config.js | 10 ---------- 9 files changed, 26 insertions(+), 44 deletions(-) diff --git a/components/_util/vnode.js b/components/_util/vnode.js index 2df7e56b8..3919d75d4 100644 --- a/components/_util/vnode.js +++ b/components/_util/vnode.js @@ -46,7 +46,7 @@ export function cloneVNodes (vnodes, deep) { export function cloneElement (n, nodeProps, clone) { const node = clone ? cloneVNode(n, true) : n - const { props = {}, key, on = {}, listeners = {}} = nodeProps + const { props = {}, key, on = {}} = nodeProps const data = node.data || {} const { style = data.style, class: cls = data.class, @@ -58,9 +58,10 @@ export function cloneElement (n, nodeProps, clone) { node.componentOptions.propsData = node.componentOptions.propsData || {} node.componentOptions.listeners = node.componentOptions.listeners || {} node.componentOptions.propsData = { ...node.componentOptions.propsData, ...props } - node.componentOptions.listeners = { ...node.componentOptions.listeners, ...listeners } + node.componentOptions.listeners = { ...node.componentOptions.listeners, ...on } + } else { + node.data.on = { ...(node.data.on || {}), ...on } } - node.data.on = { ...(node.data.on || {}), ...on } if (key !== undefined) { node.key = key diff --git a/components/button/button.vue b/components/button/button.vue index 016e3489d..b2be9f17d 100644 --- a/components/button/button.vue +++ b/components/button/button.vue @@ -73,7 +73,7 @@ export default { }, }, render () { - const { htmlType, classes, disabled, handleClick, iconType, $slots, $attrs, _events } = this + const { htmlType, classes, disabled, handleClick, iconType, $slots, $attrs, $listeners } = this const buttonProps = { props: { }, @@ -84,14 +84,10 @@ export default { }, class: classes, on: { + ...$listeners, click: handleClick, }, } - for (const [k, event] of Object.entries(_events)) { - if (!buttonProps.on[k]) { - buttonProps.on[k] = event - } - } const needInserted = $slots.default && $slots.default.length === 1 && (!iconType || iconType === 'loading') const kids = $slots.default && $slots.default.length === 1 ? this.insertSpace($slots.default[0], needInserted) : $slots.default return ( diff --git a/components/icon/icon.vue b/components/icon/icon.vue index f3fedc8ec..0f68d800c 100644 --- a/components/icon/icon.vue +++ b/components/icon/icon.vue @@ -29,6 +29,7 @@ export default { if (this.clicked) { return } + this.clicked = true clearTimeout(this.timeout) this.timeout = setTimeout(() => (this.clicked = false), 500) @@ -36,9 +37,19 @@ export default { }, }, render () { - const { title, classes, handleClick } = this + const { title, classes, handleClick, $listeners } = this + const iconProps = { + attrs: { + title, + }, + class: classes, + on: { + ...$listeners, + click: handleClick, + }, + } return ( - + ) }, beforeDestroy () { diff --git a/components/menu/src/MenuMixin.js b/components/menu/src/MenuMixin.js index 406bf6cf0..09db93ae4 100644 --- a/components/menu/src/MenuMixin.js +++ b/components/menu/src/MenuMixin.js @@ -162,7 +162,7 @@ export default { ...extraProps, openChange: this.onOpenChange, }, - listeners: { + on: { click: this.onClick, itemHover: this.onItemHover, openChange: this.onOpenChange, diff --git a/components/tooltip/demo/arrow-point-at-center.vue b/components/tooltip/demo/arrow-point-at-center.vue index ce3de704c..58905f332 100644 --- a/components/tooltip/demo/arrow-point-at-center.vue +++ b/components/tooltip/demo/arrow-point-at-center.vue @@ -4,21 +4,11 @@ ## 箭头指向 设置了 `arrowPointAtCenter` 后,箭头将指向目标元素的中心。 - + Align edge / 边缘对齐 - - + + Arrow points to center / 箭头指向中心 - + - - diff --git a/components/trigger/index.vue b/components/trigger/index.vue index 50ce72b46..8c4fa9dc7 100644 --- a/components/trigger/index.vue +++ b/components/trigger/index.vue @@ -493,13 +493,12 @@ export default { props: {}, on: { _ANT_EVENT_HACK: () => {} }, key: 'trigger', - listeners: {}, } if (this.isContextMenuToShow()) { - newChildProps.listeners.contextMenu = this.onContextMenu + newChildProps.on.contextMenu = this.onContextMenu } else { - newChildProps.listeners.contextMenu = this.createTwoChains('contextMenu') + newChildProps.on.contextMenu = this.createTwoChains('contextMenu') } if (this.isClickToHide() || this.isClickToShow()) { diff --git a/examples/components/demoBox.vue b/examples/components/demoBox.vue index 4ee9c36b7..9b873e0a5 100644 --- a/examples/components/demoBox.vue +++ b/examples/components/demoBox.vue @@ -51,9 +51,6 @@ export default { } }, methods: { - test () { - console.log(122) - }, toggle () { this.isOpen = !this.isOpen }, diff --git a/package.json b/package.json index 67577705e..c5478c444 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,6 @@ "less": "^2.7.2", "less-loader": "^4.0.5", "markdown-it": "^8.4.0", - "markdown-it-anchor": "^4.0.0", "marked": "^0.3.7", "mocha": "^3.2.0", "pre-commit": "^1.2.2", @@ -75,7 +74,6 @@ "style-loader": "^0.18.2", "stylelint": "^8.1.1", "stylelint-config-standard": "^17.0.0", - "transliteration": "^1.6.2", "vue-antd-md-loader": "^1.0.2", "vue-loader": "^13.0.5", "vue-router": "^3.0.1", diff --git a/webpack.base.config.js b/webpack.base.config.js index a6170d7e3..35ca4a425 100644 --- a/webpack.base.config.js +++ b/webpack.base.config.js @@ -1,5 +1,4 @@ const path = require('path') -const slugify = require('transliteration').slugify const hljs = require('highlight.js') const Token = require('markdown-it/lib/token') const cheerio = require('cheerio') @@ -36,15 +35,6 @@ const renderHighlight = function (str, lang) { } catch (err) {} } -function wrap (render) { - return function (tokens) { - return render.apply(this, arguments) - .replace('', '') - .replace('', '') - } -}; - const md = require('markdown-it')('default', { html: true, breaks: true,
', '') - .replace('', '') - } -}; - const md = require('markdown-it')('default', { html: true, breaks: true,
') - .replace('', '') - } -}; - const md = require('markdown-it')('default', { html: true, breaks: true,
', '') - } -}; - const md = require('markdown-it')('default', { html: true, breaks: true,
') - } -}; - const md = require('markdown-it')('default', { html: true, breaks: true,