How to use the @tarojs/taro.Component function in @tarojs/taro

To help you get started, we’ve selected a few @tarojs/taro examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NervJS / taro-ui / src / pages / view / countdown / index.js View on Github external
import Taro from '@tarojs/taro'
import { View } from '@tarojs/components'
import { AtCountdown } from 'taro-ui'
import DocsHeader from '../../components/doc-header'
import './index.scss'

export default class CountDownPage extends Taro.Component {
  config = {
    navigationBarTitleText: 'Taro UI'
  }

  onTimeUp () {
    Taro.showToast({
      title: '时间到',
      icon: 'success',
      duration: 2000
    })
  }

  render () {
    return (
github NervJS / taro-ui / src / pages / view / timeline / index.js View on Github external
import Taro from '@tarojs/taro'
import { View } from '@tarojs/components'
import { AtTimeline } from 'taro-ui'
import DocsHeader from '../../components/doc-header'
import './index.scss'

export default class TimelinePage extends Taro.Component {
  config = {
    navigationBarTitleText: 'Taro UI'
  }

  render () {
    return (
github NervJS / taro-ui-demo / src / pages / action / activity-indicator / index.js View on Github external
import Taro from '@tarojs/taro'
import { View } from '@tarojs/components'
import { AtActivityIndicator } from 'taro-ui'

import DocsHeader from '../../components/doc-header'
import './index.scss'

export default class ActivityIndicatorPage extends Taro.Component {
  config = {
    navigationBarTitleText: 'Taro UI'
  }

  constructor () {
    super(...arguments)
    this.atButton = ''
    this.state = {}
  }

  render () {
    return (
github shenqihui / taro_scaffold / src / pages / jump / index.tsx View on Github external
import Taro from '@tarojs/taro';
import { View } from '@tarojs/components';

import { debugAdd } from '../../utils/debug';

import './index.scss';

export default class PageComponent extends Taro.Component {
  config = {
    navigationBarTitleText: '跳转的页面',
  }

  constructor(props) {
    super(props);
    debugAdd('jump', this);
    this.state = {};
  }

  componentDidMount = () => {
  }

  componentWillReceiveProps = (nextProps) => {
    console.log(this.props, nextProps);
  }
github NervJS / taro-ui / src / pages / layout / card / index.js View on Github external
import Taro from '@tarojs/taro'
import { View } from '@tarojs/components'
import { AtCard, AtIcon } from 'taro-ui'
import DocsHeader from '../../components/doc-header'
import './index.scss'

export default class CardPage extends Taro.Component {
  config = {
    navigationBarTitleText: 'Taro UI'
  }

  handleClick = () => {
    console.log('Card handleClick')
  }

  render () {
    return (
github NervJS / taro-ui / src / components / calendar / body / index.tsx View on Github external
import { delayQuerySelector } from '../../../common/utils'

const ANIMTE_DURATION: number = 300

const defaultProps: Partial = {
  marks: [],
  selectedDate: {
    end: Date.now(),
    start: Date.now()
  },
  format: 'YYYY-MM-DD',
  generateDate: Date.now()
}

export default class AtCalendarBody extends Taro.Component<
  Props,
  Readonly
  > {
  static options = { addGlobalClass: true }
  static defaultProps: Partial = defaultProps

  private changeCount: number = 0
  private currentSwiperIndex: number = 1
  private startX: number = 0
  private swipeStartPoint: number = 0
  private isPreMonth: boolean = false
  private maxWidth: number = 0
  private isTouching: boolean = false

  private generateFunc: (
    generateDate: number,
github NervJS / taro-ui / src / pages / navigation / navbar / index.js View on Github external
import Taro from '@tarojs/taro'
import { View } from '@tarojs/components'
import { AtNavBar } from 'taro-ui'
import DocsHeader from '../../components/doc-header'
import './index.scss'

export default class Index extends Taro.Component {
  config = {
    navigationBarTitleText: 'Taro UI'
  }
  handleClick (title) {
    Taro.showToast({
      'title': title,
      'duration': 2000,
      'icon': 'success'
    })
  }
  clickReturn () {
    Taro.showToast({
      'title': '返回',
      'duration': 2000,
      'icon': 'success'
    })
github NervJS / taro-ui-demo / src / pages / basic / button / index.js View on Github external
import Taro from '@tarojs/taro'
import { View, Form } from '@tarojs/components'

import { AtButton, AtForm } from 'taro-ui'
import DocsHeader from '../../components/doc-header'

import './index.scss'

export default class ButtonPage extends Taro.Component {
  config = {
    navigationBarTitleText: 'Taro UI'
  }

  state = {
    isWEAPP: Taro.getEnv() === Taro.ENV_TYPE.WEAPP,
    isALIPAY: Taro.getEnv() === Taro.ENV_TYPE.ALIPAY,
  }

  onButtonClick () {
    const content = [...arguments].find(item => typeof item === 'string')
    const ENV = Taro.getEnv()
    if (ENV === 'WEAPP') Taro.showModal({ content: content || '您点击了!', showCancel: false })
    else if (ENV === 'WEB') alert(content || '您点击了!')
  }
github NervJS / taro-ui / src / pages / navigation / tabbar / index.js View on Github external
import Taro from '@tarojs/taro'
import { View } from '@tarojs/components'
import { AtTabBar } from 'taro-ui'
import DocsHeader from '../../components/doc-header'
import './index.scss'

export default class Index extends Taro.Component {
  config = {
    navigationBarTitleText: 'Taro UI'
  }

  constructor () {
    super(...arguments)
    this.state = {
      current1: 0,
      current2: 0,
      current3: 0,
      current4: 0,
      current5: 0,
    }
  }

  handleClick (num, value) {
github BinZhiZhu / Taro-v2ex-weapp / src / components / base / index.tsx View on Github external
import Taro, {ComponentClass} from '@tarojs/taro'
import {AtActivityIndicator} from "taro-ui";

type pageProps = {
  content: string,
  mode?: any,
  color: string
}

/**
 * 页面加载器
 */
class Loading extends Taro.Component {

  static defaultProps = {
    content: '加载中...',
    mode: 'center',
    color:'#eb6e48'
  };

  render() {
    const { color, content, mode } = this.props;

    return (