GithubHelp home page GithubHelp logo

增加环境判断 about remax HOT 13 CLOSED

remaxjs avatar remaxjs commented on August 16, 2024
增加环境判断

from remax.

Comments (13)

yesmeck avatar yesmeck commented on August 16, 2024 2

环境还是用

process.env.REMAX_ENV

process.env.NODE_ENV

from remax.

yesmeck avatar yesmeck commented on August 16, 2024
import { env } from 'remax';

console.log(env.isAliay); // true
console.log(env.isWexin); // false

这样?

from remax.

Darmody avatar Darmody commented on August 16, 2024

env 可以用来表示 production development

另外常量是不是应该大写

from remax.

yesmeck avatar yesmeck commented on August 16, 2024

我们不分 production/development 的。

from remax.

Darmody avatar Darmody commented on August 16, 2024

我们不分 production/development 的。

为什么呢?如果我写了一个辅助调试的组件,只想在开发环境打开,怎么办

from remax.

yesmeck avatar yesmeck commented on August 16, 2024

有道理,那用 platform?

import { Platform } from 'remax';

console.log(Platform.current); // 'alipay'
console.log(Platform.isAliay); // true
console.log(Platform.isWexin); // false

from remax.

yesmeck avatar yesmeck commented on August 16, 2024

https://facebook.github.io/react-native/docs/platform-specific-code

from remax.

Darmody avatar Darmody commented on August 16, 2024

LGTM
LGTM

from remax.

Darmody avatar Darmody commented on August 16, 2024
Platform.os // ios | android
Platform.target // alipay | weapp | ...
Platform.env // production | development | testing
Platform.isAlipay
Platform.isProduction
Platform.isIOS
...

@yesmeck

from remax.

Darmody avatar Darmody commented on August 16, 2024

Platform.os
os 应该交给各端的api 去获取

from remax.

yesmeck avatar yesmeck commented on August 16, 2024

Platform.env 不要

from remax.

yesmeck avatar yesmeck commented on August 16, 2024

Platform.target => Platform.current

target 是构建的时候构建目标平台是什么。当下就不叫 target 了。

from remax.

Darmody avatar Darmody commented on August 16, 2024

环境还是用

process.env.REMAX_ENV

process.env.NODE_ENV

👍

from remax.

Related Issues (20)

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.