site: fix production dev switch button

This commit is contained in:
07akioni 2020-10-30 17:42:34 +08:00
parent 5af594d08e
commit b346384491
8 changed files with 10 additions and 14 deletions

View File

@ -48,7 +48,7 @@
{{ langOptions[lang].label }}
</n-tag>
<n-tag
v-if="env === 'development'"
v-if="dev"
class="nav-picker"
@click="handleModeChange"
>
@ -62,7 +62,7 @@
<script>
import { computed, readonly, ref } from 'vue'
import version from '../src/version'
import { useSiteTheme, useSiteLang, displayModeRef, envRef, i18n } from './util-compositions'
import { useSiteTheme, useSiteLang, displayModeRef, i18n } from './util-composables'
function match (pattern, string) {
if (!pattern.length) return true
@ -129,7 +129,7 @@ export default {
t,
searchInputValue: ref(''),
version,
env: envRef,
dev: __DEV__,
displayMode: displayModeRef,
lang: useSiteLang(),
theme: useSiteTheme(),

View File

@ -44,7 +44,7 @@
import LandingFooter from './Footer.vue'
import leftImage from './Left.vue'
import rightImage from './Right.vue'
import { i18n } from '../../util-compositions'
import { i18n } from '../../util-composables'
export default {
inject: {

View File

@ -1,7 +1,5 @@
import { h } from 'vue'
const env = process.env.NODE_ENV
const appendCounts = item => {
if (!item.childItems) {
item.count = 1
@ -37,13 +35,13 @@ const appendCounts = item => {
}
const appendDeprecatedDemos = (item, mode) => {
if ((env === 'development' && mode === 'debug') || localStorage.getItem('nimbus')) {
if ((__DEV__ && mode === 'debug') || localStorage.getItem('nimbus')) {
return [item]
} else return []
}
const appendDebugDemos = (item, mode) => {
if (env === 'development' && mode === 'debug') {
if (__DEV__ && mode === 'debug') {
return [item]
} else return []
}

View File

@ -30,8 +30,6 @@ export function useSiteLang () {
return toRef(inject('SiteProvider'), 'lang')
}
export const envRef = ref(process.env.NODE_ENV)
export const i18n = function (data) {
const configProvider = inject('NConfigProvider', null)
return {

View File

@ -61,7 +61,7 @@
<script>
import { nextTick } from 'vue'
import codeOutline from 'naive-ui/lib/icons/code-outline.vue'
import { displayModeRef, i18n } from '../util-compositions'
import { displayModeRef, i18n } from '../util-composables'
export default {
components: {

View File

@ -1,5 +1,5 @@
<script>
import { i18n } from '../util-compositions'
import { i18n } from '../util-composables'
export default {
setup () {

View File

@ -22,7 +22,7 @@
</template>
<script>
import { i18n } from '../util-compositions'
import { i18n } from '../util-composables'
export default {
name: 'EditOnGithubHeader',

View File

@ -16,6 +16,6 @@ module.exports = {
},
define: {
'process.env.NODE_ENV': `'${process.env.NODE_ENV}'`,
'__DEV__': process.env === 'development'
'__DEV__': process.env !== 'production'
}
}