Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Taro next]使用 vue 并引入 vant-weapp 微信小程序组件,组件的 prop 必须用驼峰写法 #6509

Closed
Mikasa33 opened this issue May 29, 2020 · 2 comments
Assignees

Comments

@Mikasa33
Copy link

Mikasa33 commented May 29, 2020

问题描述

使用 vue 并引入 vant-weapp 微信小程序组件,组件的 prop 必须用驼峰写法

复现步骤

第一个按钮,以及第二个按钮
image

第三个按钮
image

三种写法一起写,loading-text 的问题就会消失,不显示 NaN 而是正常显示加载提示文字,所以分开两次截图了

<template>
  <view>
    <!-- 第一个 -->
    <van-button type="primary" loading loading-text="加载中">无法显示加载状态</van-button>

    <!-- 第二个 -->
    <van-button type="primary" :loading="true" loading-text="加载中">按钮</van-button>

    <!-- 第三个 -->
    <van-button type="primary" :loading="true" loadingText="加载中">驼峰</van-button>
  </view>
</template>

期望行为

可以正常显示加载状态以及自定义加载的提示文字

报错信息

第一个按钮,使用 loading 简写,无法显示加载状态,必须写完整 :loading="true"
第二个按钮,使用 - 的写法无法自定义加载的提示文字,显示 NaN
第三个按钮,使用驼峰写法可以正常显示加载状态以及自定义加载的提示文字

系统信息

👽 Taro v3.0.0-rc.2

Taro CLI 3.0.0-rc.2 environment info:
System:
OS: macOS 10.14.6
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 11.15.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.7.0 - /usr/local/bin/npm
npmPackages:
@tarojs/components: 3.0.0-rc.2 => 3.0.0-rc.2
@tarojs/mini-runner: 3.0.0-rc.2 => 3.0.0-rc.2
@tarojs/runtime: 3.0.0-rc.2 => 3.0.0-rc.2
@tarojs/taro: 3.0.0-rc.2 => 3.0.0-rc.2
@tarojs/webpack-runner: 3.0.0-rc.2 => 3.0.0-rc.2
babel-preset-taro: 3.0.0-rc.2 => 3.0.0-rc.2
eslint-config-taro: 3.0.0-rc.2 => 3.0.0-rc.2

补充信息

暂无

@yuche
Copy link
Contributor

yuche commented Jun 1, 2020

如果不添加值,Vue 的默认值就会给一个空字符串,这点和 React 是不一样的:
https://codesandbox.io/s/nice-neumann-gj3lj?file=/src/App.vue

@Mikasa33
Copy link
Author

Mikasa33 commented Jun 2, 2020

明白了!多谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants