Skip to content

vuepress-next 使用 antd 2.0 报错 #3600

@tomgao365

Description

@tomgao365
  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

2.0.0-rc.9

Environment

win10,node 14.15.4

Reproduction link

https://github.com/my-alpha/vuepress-next-demo.git

Steps to reproduce

1.参考官方快速上手创建前端项目 2.添加2.0.0-rc.9依赖

{
  "name": "vuepress-next-demo",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "dev": "vuepress dev docs",
    "build": "vuepress build docs"
  },
  "dependencies": {
    "ant-design-vue": "^2.0.0-rc.9",
    "vuepress": "^2.0.0-alpha.19"
  },
  "devDependencies": {
    "less": "^4.1.0",
    "less-loader": "^7.3.0"
  }
}
  1. docs/.vuepress创建config.tsclientAppEnhance.ts
  • config.ts
import type { UserConfig, DefaultThemeOptions } from 'vuepress';

const config: UserConfig<DefaultThemeOptions> = {
  lang: 'zh-CN',
  title: 'Ant Design Vue 测试',
  description: 'Ant Design Vue v2 测试',
  port: 3000,
  bundlerConfig: {
    less: {
      lessOptions: {
        modifyVars: {},
        javascriptEnabled: true,
      },
    },
  },
};

// @ts-ignore
export = config;
  • clientAppEnhance.ts
import type { ClientAppEnhance } from '@vuepress/client';
import antd from 'ant-design-vue';
import 'ant-design-vue/dist/antd.less';

const clientAppEnhance: ClientAppEnhance = ({ app }) => {
  app.use(antd);
};

export default clientAppEnhance;
  1. docs/README.md 使用 tooltip
# Hello VuePress

测试

<a-tooltip title="tooltip 标题">
这是 tooltip
</a-tooltip>

<a-card title="card 标题">
这是 card
</a-card>
  1. 执行yarn dev,打开vuepree网页,antd组件报错。

What is expected?

正常运行,显示 tooltip

What is actually happening?

a-tooltip 组件报错

Uncaught (in promise) TypeError: this.isNoTitle is not a function
    at Proxy.render (webpack-internal:///./node_modules/ant-design-vue/es/tooltip/Tooltip.js:203)
    at renderComponentRoot (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:794)
    at componentEffect (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:4232)
    at reactiveEffect (webpack-internal:///./node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js:73)
    at effect (webpack-internal:///./node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js:48)
    at setupRenderEffect (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:4215)
    at mountComponent (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:4173)
    at processComponent (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:4133)
    at patch (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:3760)
    at mountChildren (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:3933)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions