mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-03 04:21:34 +08:00
site: fix production dev switch button
This commit is contained in:
parent
5af594d08e
commit
b346384491
@ -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(),
|
||||
|
@ -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: {
|
||||
|
@ -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 []
|
||||
}
|
||||
|
@ -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 {
|
@ -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: {
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import { i18n } from '../util-compositions'
|
||||
import { i18n } from '../util-composables'
|
||||
|
||||
export default {
|
||||
setup () {
|
||||
|
@ -22,7 +22,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { i18n } from '../util-compositions'
|
||||
import { i18n } from '../util-composables'
|
||||
|
||||
export default {
|
||||
name: 'EditOnGithubHeader',
|
||||
|
@ -16,6 +16,6 @@ module.exports = {
|
||||
},
|
||||
define: {
|
||||
'process.env.NODE_ENV': `'${process.env.NODE_ENV}'`,
|
||||
'__DEV__': process.env === 'development'
|
||||
'__DEV__': process.env !== 'production'
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user