Skip to content

Commit

Permalink
fix(mobile): fix mobile components build error (#2696)
Browse files Browse the repository at this point in the history
  • Loading branch information
zzcr authored Dec 26, 2024
1 parent 10ca9ef commit 13660bc
Show file tree
Hide file tree
Showing 14 changed files with 500 additions and 535 deletions.
1 change: 0 additions & 1 deletion packages/mobile/components/container/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*
*/
import Container from './src/mobile.vue'
import '@opentiny/vue-theme/container/index.less'

/* istanbul ignore next */
Container.install = function (Vue) {
Expand Down
5 changes: 3 additions & 2 deletions packages/mobile/components/date-picker/src/mobile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
readOnly="true"
:_mode="_mode"
>
<icon-close slot="suffix" v-if="!state.clearable" @click="clearDisplayValue"></icon-close>
<template #suffix>
<icon-close v-if="!state.clearable" @click="clearDisplayValue"></icon-close>
</template>
</tiny-input>
<tiny-mini-picker
v-model:visible="state.visible"
Expand All @@ -38,7 +40,6 @@ import { renderless, api } from './renderless/vue'
import MiniPicker from '../../mini-picker'
import Input from '../../input'
import { iconCloseCircle } from '@opentiny/vue-icon'
import '@opentiny/vue-theme/date-picker/index.less'

export default defineComponent({
components: {
Expand Down
2 changes: 1 addition & 1 deletion packages/mobile/components/loading/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
import service from './src/service'
import directive from './src/directive'
import { setupComponent } from '../../../vue-common'
import { setupComponent } from '../../vue-common'

const Loadings: any = {
install(app) {
Expand Down
2 changes: 1 addition & 1 deletion packages/mobile/components/modal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
*/

import { createComponent, setupComponent } from '../../../vue-common'
import { createComponent, setupComponent } from '../../vue-common'
import { MsgQueue } from './src/renderless'
import TINYModal from './src/mobile.vue'

Expand Down
4 changes: 2 additions & 2 deletions packages/mobile/components/multi-select-item/src/mobile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
</template>

<script lang="ts">
import { $prefix, props, setup, defineComponent } from '../../../vue-common'
import { $prefix, setup, defineComponent } from '../../../vue-common'
import { renderless, api } from './renderless/vue'
import { iconChevronDown } from '@opentiny/vue-icon'
import Button from '@opentiny/vue-button'
import Button from '../../button'
import { multiSelectItemProps } from './multi-select-item'
import '@opentiny/vue-theme-mobile/multi-select-item/index.less'

Expand Down
1 change: 0 additions & 1 deletion packages/mobile/components/popover/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*
*/
import Popover from './src/mobile.vue'
import '@opentiny/vue-theme/popover/index.less'

/* istanbul ignore next */
Popover.install = function (Vue) {
Expand Down
3 changes: 1 addition & 2 deletions packages/mobile/components/tooltip/src/mobile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import {
defineComponent,
isEmptyVnode,
hooks
} from '../../..//vue-common'
import '@opentiny/vue-theme/tooltip/index.less'
} from '../../../vue-common'
import type { ITooltipApi, ITinyVm } from './tooltip'
import { tooltipProps } from './tooltip'

Expand Down
4 changes: 1 addition & 3 deletions packages/mobile/components/upload/src/mobile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
-->

<script lang="tsx">
import { $prefix, setup, h, defineComponent, props } from '@opentiny/vue-common'
import { $prefix, setup, h, defineComponent } from '../../../vue-common'

// 此处引入 h 是为了防止打包后 h 被重命名导致组件报错的问题
import { renderless, api } from './renderless/vue'
Expand All @@ -37,7 +37,6 @@ export default defineComponent({
let {
accept,
disabled,
drag,
handleChange,
handleClick,
handlePaste,
Expand All @@ -46,7 +45,6 @@ export default defineComponent({
listType,
multiple,
name,
uploadFiles,
fileList,
limit,
isHidden,
Expand Down
1 change: 1 addition & 0 deletions packages/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@better-scroll/wheel": "^2.5.0",
"@opentiny/vue-icon": "workspace:~",
"@opentiny/mobile-utils": "workspace:~",
"@opentiny/vue-theme-mobile": "workspace:~",
"@opentiny/vue-locale": "workspace:~"
},
"devDependencies": {
Expand Down
7 changes: 2 additions & 5 deletions packages/mobile/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import dts from 'vite-plugin-dts'
import svgLoader from 'vite-svg-loader'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), vueJsx(), dts(), svgLoader()],
plugins: [vue(), vueJsx(), svgLoader()],
build: {
lib: {
entry: './index.ts'
},
minify: true,
rollupOptions: {
external: [/@better-scroll/, /@opentiny/],
external: [/@opentiny\/vue/, /@better-scroll/, 'vue', 'xss'],
input: ['index.ts'],
output: [
{
Expand Down
6 changes: 1 addition & 5 deletions packages/mobile/vue-common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
} from './src/adapter'
import { t } from '@opentiny/vue-locale'
import { stringifyCssClass, stringifyCssClassObject, stringifyCssClassArray, deduplicateCssClass } from './src/csscls'
import '@opentiny/vue-theme/base/index.less'
import { defineComponent, isVue2, isVue3 } from './src/adapter'
import { useBreakpoint } from './src/breakpoint'
import { useDefer } from './src/usedefer'
Expand Down Expand Up @@ -164,7 +163,6 @@ export const setup = ({ props, context, renderless, api, extendOptions = {}, cla
const globalDesignConfig: DesignConfig = customDesignConfig.designConfig || hooks.inject(design.configKey, {})
const designConfig = globalDesignConfig?.components?.[getComponentName().replace($prefix, '')]

const specifyPc = typeof process === 'object' ? process.env?.TINY_MODE : null
const utils = {
$prefix,
t,
Expand Down Expand Up @@ -233,16 +231,14 @@ export function svg({ name = 'Icon', component }) {
defineComponent({
name: $prefix + name,
setup: (props, context) => {
const { fill, width, height, 'custom-class': customClass } = context.attrs || {}
const { fill, width, height } = context.attrs || {}
const mergeProps = Object.assign({}, props, propData || null)
const mode = resolveMode(mergeProps, context)
const isMobileFirst = mode === 'mobile-first'
const tinyTag = { 'data-tag': isMobileFirst ? 'tiny-svg' : null }
const attrs = isVue3 ? tinyTag : { attrs: tinyTag }
let className = 'tiny-svg'

const specifyPc = typeof process === 'object' ? process.env?.TINY_MODE : null

const extend = Object.assign(
{
style: { fill, width, height },
Expand Down
Loading

0 comments on commit 13660bc

Please sign in to comment.