Giter Site home page Giter Site logo

liurubin / mounted Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fjc0k/mounted

0.0 0.0 0.0 920 KB

基于 Taro 的小程序组件库。

Home Page: https://npm.im/mounted

License: MIT License

JavaScript 2.52% TypeScript 79.65% CSS 16.90% HTML 0.93%

mounted's Introduction

v1 版本还不甚稳定,请勿用于生产环境!

Mounted

一款基于 Taro 的小程序组件库。

⚠ 注意

  • 目前仅支持 微信小程序

  • 推荐和 TypeScript 一起使用。

特性

  • 使用 TypeScript 编写。
  • 专注 小程序
  • 只产出与业务低耦合的 基础组件
  • 支持 自定义主题

使用

首先,使用以下命令安装:

# yarn
yarn add mounted

# 或者,npm
npm i mounted --save

然后,在 app.scss 中引入组件样式:

若你未使用 scss,请在 app.js 同级目录新建 app.scss,并在 app.js 中引入:import './app.scss'

@import '../node_modules/mounted/src/styles/components.scss';

最后,在页面中按需引入组件:

import Taro from '@tarojs/taro'
import { View, Text } from '@tarojs/components'
import { MSticky } from 'mounted'

export default class Demo extends Taro.Component {
  render() {
    return (
      <View>
        <MSticky>
          <View className='title'>
            <Text>标题</Text>
          </View>
        </MSticky>
      </View>
    )
  }
}

自定义主题

若需自定义主题,直接在 app.scss 中覆盖变量即可,如:

// 主色调
$primaryColor: #1AAD19;

@import '../node_modules/mounted/src/styles/components.scss';

组件库所使用的样式变量都在 src/styles/settings.scss 文件内。

设计稿尺寸

组件库内部采用的是 375 尺寸,若你的项目也是基于 375 的,可跳过。

若你的项目是基于其他尺寸,比如 750 的,请在 app.scss 中覆盖设计稿尺寸变量:

// 设计稿尺寸
$designWidth: 750;

@import '../node_modules/mounted/src/styles/components.scss';

许可

MIT © Jay Fong

mounted's People

Contributors

fjc0k avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.