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 v3.0.0-alpha.2 微信小程序WUI组件Navigation插槽slot失效 #5476

Closed
leslie846933 opened this issue Feb 15, 2020 · 6 comments
Closed
Assignees

Comments

@leslie846933
Copy link

leslie846933 commented Feb 15, 2020

问题描述

Taro v3.0.0-alpha.2 微信小程序WUI组件Navigation插槽slot失效

复现步骤

import Taro from '@tarojs/taro';
import React, { Component } from 'react'
import { View } from "@tarojs/components";
import './index.less';

class NavigationBar extends Component {

  /**
   * @Description: 返回事件
   * @Author: ChenFu
   * @Date: 2020/2/1
   */
  clickBackHandle () {
    Taro.navigateBack()
  }

  /**
   * @Description: 主页事件
   * @Author: ChenFu
   * @Date: 2020/2/1
   */
  clickHomeHandle () {
    Taro.switchTab({
      url: '/pages/index/index'
    })
  }

  render() {
    const { loading, show, animated, background, title, back, isHome, mode } = this.props;

    return (
      <mp-navigation-bar
        loading={loading}
        show={show}
        animated={animated}
        color={mode === 'dark' ? '#000000' : '#ffffff'}
        background={background}
        title={title}
        back={back}
      >
        {
          !isHome && (
            <View className={['navigation-left', mode === 'dark' ? 'is-dark' : ''].join(' ')} slot='left'>
              <View className='yjd-icon yjd-icon-left back-action' onClick={this.clickBackHandle.bind(this)} />
              <View className='navigation-divider' />
              <View className='yjd-icon yjd-icon-home-fill home-action' onClick={this.clickHomeHandle.bind(this)} />
            </View>
          )
        }
      </mp-navigation-bar>
    )
  }
}

export default NavigationBar;
// navigation-bar.wxml

<view class="weui-navigation-bar {{extClass}}">
  <view class="weui-navigation-bar__placeholder {{ios ? 'ios' : 'android'}}" style="padding-top: {{statusBarHeight}}px;visibility: hidden;"></view>
  <view class="weui-navigation-bar__inner {{ios ? 'ios' : 'android'}}" style="padding-top: {{statusBarHeight}}px; color: {{color}};background: {{background}};{{displayStyle}};{{innerPaddingRight}};{{innerWidth}};">

    <view class='weui-navigation-bar__left' style="{{leftWidth}}">
      <block wx:if="{{back}}">
        <view class="weui-navigation-bar__buttons">
          <view bindtap="back" class="weui-navigation-bar__button weui-navigation-bar__btn_goback"></view>
        </view>
      </block>
      <block wx:else>
        <slot name="left"></slot>
      </block>
    </view>

    <view class='weui-navigation-bar__center'>
      <view wx:if="{{loading}}" class="weui-navigation-bar__loading">
        <view class="weui-loading" style="width:{{size.width}}rpx;height:{{size.height}}rpx;"></view>
      </view>
      <block wx:if="{{title}}">
        <text>{{title}}</text>
      </block>
      <block wx:else>
        <slot name="center"></slot>
      </block>
    </view>

    <view class='weui-navigation-bar__right'>
      <slot name="right"></slot>
    </view>
  </view>
</view>

期望行为

插槽能正常编译

报错信息

系统信息

Taro CLI 3.0.0-alpha.2 environment info:
System:
OS: macOS 10.14.6
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.12.0 - /usr/local/bin/node
Yarn: 1.7.0 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
npmPackages:
@tarojs/components: 3.0.0-alpha.2 => 3.0.0-alpha.2
@tarojs/taro: 3.0.0-alpha.2 => 3.0.0-alpha.2
eslint-config-taro: 3.0.0-alpha.2 => 3.0.0-alpha.2
react: ^16.10.0 => 16.12.0

补充信息

如果您有功能上的建议,可以提到 FeatHub

使用上的问题,欢迎在「Taro 社区」一起交流

@taro-bot
Copy link

taro-bot bot commented Feb 15, 2020

CC @Chen-jj

@taro-bot
Copy link

taro-bot bot commented Feb 15, 2020

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@leslie846933 leslie846933 changed the title Taro v3.0.0-alpha.2 因为微信小程序WUI组件Navigation插槽slot失效 Taro v3.0.0-alpha.2 微信小程序WUI组件Navigation插槽slot失效 Feb 15, 2020
@yuche
Copy link
Contributor

yuche commented Feb 15, 2020

你把 children 中的条件表达式去掉看看是否可行,若可行更新 alpha.3,不可行麻烦做一个简单的复现 repo。

@leslie846933
Copy link
Author

你把 children 中的条件表达式去掉看看是否可行,若可行更新 alpha.3,不可行麻烦做一个简单的复现 repo。

@yuche 表达式我去过,也不行的

@taro-bot
Copy link

taro-bot bot commented Feb 17, 2020

Hello~

您的问题我们无法复现。如果有空的话还请拔冗提供一个简单的复现 demo,否则这个 issue 将在 15 天后被自动关闭。

如果您在这 15 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。

Good luck and happy coding~

@taro-bot taro-bot bot removed the to be closed label Mar 3, 2020
@taro-bot taro-bot bot closed this as completed Mar 3, 2020
@dobeweb
Copy link

dobeweb commented Sep 28, 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

4 participants