Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>vscode-taro-snippetsNew to Visual Studio Code? Get it now.
vscode-taro-snippets

vscode-taro-snippets

crper

|
3,490 installs
| (0) | Free
Code snippets for Taro
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

VSCode-taro-snippets

Version Install

为了少敲重复代码,节约时间,这个东东就出来了;

用JS的格式,但是智能提示响应范围包括如下

  • typescript
  • javascript
  • javascriptreact
  • typescriptreact

部分位置设置了占位符,可以初始化的时候修改及tab切换


效果

演示Demo


代码片段

  • tarocc
import Taro , { Component } from '@tarojs/taro';
import { View, Text , Button} from '@tarojs/components';

export default class Index extends Component {

   config = {
       navigationBarTitleText: ''
  }

  state={}

  componentWillMount () {}
  componentDidMount () {}
  componentWillReceiveProps (nextProps,nextContext) {}
  componentWillUnmount () {}
  componentDidShow () {}
  componentDidHide () {}
  componentDidCatchError () {}
  componentDidNotFound () {}
  render() {
    return (
      <View>

      </View>
    );
  }
}
export default Index;

  • taropc

import Taro , { PureComponent } from '@tarojs/taro';
import { View, Text , Button} from '@tarojs/components';

class Index extends PureComponent {

   config = {
       navigationBarTitleText: ''
  }

  state={}

  componentWillMount () {}
  componentDidMount () {}
  componentWillReceiveProps (nextProps,nextContext) {}
  componentWillUnmount () {}
  componentDidShow () {}
  componentDidHide () {}
  componentDidCatchError () {}
  componentDidNotFound () {}
  render() {
    return (
      <View>

      </View>
    );
  }
}
export default Index;

  • taroaf
config = {
  pages: [
    'pages/index/index'
     ],
  window: {
    backgroundTextStyle: 'light',
    navigationBarBackgroundColor: '#fff',
    navigationBarTitleText: 'WeChat',
    navigationBarTextStyle: 'black'
    }
}

  • taroimd
import {} from '@tarojs/mobx'
  • taroird
import {} from '@tarojs/redux'
  • taroimm
import {} from '$tarojs/'
  • taroir
import { connect } from '@tarojs/redux'
  • taroim
import {inject, observer} from '@tarojs/mobx'
  • imo
import { action, observable, computed, toJS } from 'mobx'

其他

没有做专门的ts版本,有兴趣的小伙伴可以提交PR

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft