diff --git a/packages/uni-app-vue/dist/nvue.factory.cjs.js b/packages/uni-app-vue/dist/nvue.factory.cjs.js index 5d72e2c58354cba6c5fe8306847cb1b137201f76..5b577d56cfb6e23d26f5eef1c362566f215a97fc 100644 --- a/packages/uni-app-vue/dist/nvue.factory.cjs.js +++ b/packages/uni-app-vue/dist/nvue.factory.cjs.js @@ -265,20 +265,6 @@ function vueFactory(exports) { return _globalThis || (_globalThis = typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {}); }; - var latestNodeId = 1; - - class NVueTextNode { - constructor(text) { - this.instanceId = ''; - this.nodeId = latestNodeId++; - this.parentNode = null; - this.nodeType = 3; - this.text = text; - this.children = []; - } - - } - var activeEffectScope; var effectScopeStack = []; @@ -9305,7 +9291,7 @@ function vueFactory(exports) { createElement: tag => { return document.createElement(tag); }, - createText: text => new NVueTextNode(text), + createText: text => document.createText(text), createComment: text => document.createComment(text), setText: (node, text) => { node.setAttr('value', text); @@ -9317,19 +9303,58 @@ function vueFactory(exports) { nextSibling: node => node.nextSibling }; - function isUndef(val) { - return val === undefined || val === null; + function useCssStyles(styles) { + var normalized = {}; + + if (isArray(styles)) { + styles.forEach(style => { + Object.keys(style).forEach(name => { + if (hasOwn(normalized, name)) { + extend(normalized[name], style[name]); + } else { + normalized[name] = style[name]; + } + }); + }); + } + + return normalized; + } + + function parseStylesheet(_ref23) { + var { + type, + vnode: { + appContext + } + } = _ref23; + + if (!type.__styles) { + var styles = []; + + if (appContext) { + styles.push(appContext.provides.__appStyles); + } + + if (isArray(type.styles)) { + type.styles.forEach(style => styles.push(style)); + } + + type.__styles = useCssStyles(styles); + } + + return type.__styles; } - function parseStylesheet(instance) { - return instance.type.__stylesheet || {}; + function isUndef(val) { + return val === undefined || val === null; } function patchAttr(el, key, value) { var instance = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; if (instance) { - value = transformAttr(el, key, value, instance); + [key, value] = transformAttr(el, key, value, instance); } if (value == null) ;else { @@ -9373,26 +9398,28 @@ function vueFactory(exports) { function transformAttr(el, key, value, instance) { if (!value) { - return value; + return [key, value]; } var opts = CLASS_AND_STYLES[el.type]; if (opts) { - if (opts['class'].indexOf(key) !== -1) { - return parseStylesheet(instance)[value] || {}; + var camelized = camelize(key); + + if (opts['class'].indexOf(camelized) > -1) { + return [camelized, parseStylesheet(instance)[value] || {}]; } - if (opts['style'].indexOf(key) !== -1) { + if (opts['style'].indexOf(key) > -1) { if (isString(value)) { - return parseStringStyle(value); + return [camelized, parseStringStyle(value)]; } - return normalizeStyle(value); + return [camelized, normalizeStyle(value)]; } } - return value; + return [key, value]; } // compiler should normalize class + :class bindings on the same element // into a single binding ['staticClass', dynamic] @@ -9833,6 +9860,7 @@ function vueFactory(exports) { unref: unref, useAttrs: useAttrs, useCssModule: useCssModule, + useCssStyles: useCssStyles, useCssVars: useCssVars, useSSRContext: useSSRContext, useSlots: useSlots, @@ -9851,6 +9879,7 @@ function vueFactory(exports) { withScopeId: withScopeId, camelize: camelize, capitalize: capitalize, + hyphenate: hyphenate, normalizeClass: normalizeClass, normalizeProps: normalizeProps, normalizeStyle: normalizeStyle, diff --git a/packages/uni-app-vue/lib/nvue.runtime.esm.js b/packages/uni-app-vue/lib/nvue.runtime.esm.js index 0e998e3db5c6b06a247442fb0819e8ddc899bc01..6685eb6184557a8b605d65f1405271ffc023ee74 100644 --- a/packages/uni-app-vue/lib/nvue.runtime.esm.js +++ b/packages/uni-app-vue/lib/nvue.runtime.esm.js @@ -1,6 +1,5 @@ -import { NVueTextNode } from '@dcloudio/uni-shared'; import { extend, isArray, isMap, isIntegerKey, isSymbol, hasOwn, isObject, hasChanged, makeMap, capitalize, toRawType, def, isFunction, NOOP, isString, isPromise, getGlobalThis, EMPTY_OBJ, toHandlerKey, toNumber, hyphenate, camelize, isOn, isModelListener, remove, isSet, isPlainObject, invokeArrayFns, isReservedProp, EMPTY_ARR, NO, normalizeClass, normalizeStyle, isGloballyWhitelisted, parseStringStyle } from '@vue/shared'; -export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared'; +export { camelize, capitalize, hyphenate, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared'; function warn(msg, ...args) { console.warn(`[Vue warn] ${msg}`, ...args); @@ -8863,7 +8862,7 @@ const nodeOps = { createElement: (tag) => { return document.createElement(tag); }, - createText: text => new NVueTextNode(text), + createText: text => document.createText(text), createComment: text => document.createComment(text), setText: (node, text) => { node.setAttr('value', text); @@ -8875,17 +8874,43 @@ const nodeOps = { nextSibling: node => node.nextSibling }; +function useCssStyles(styles) { + const normalized = {}; + if (isArray(styles)) { + styles.forEach(style => { + Object.keys(style).forEach(name => { + if (hasOwn(normalized, name)) { + extend(normalized[name], style[name]); + } + else { + normalized[name] = style[name]; + } + }); + }); + } + return normalized; +} +function parseStylesheet({ type, vnode: { appContext } }) { + if (!type.__styles) { + const styles = []; + if (appContext) { + styles.push(appContext.provides.__appStyles); + } + if (isArray(type.styles)) { + type.styles.forEach(style => styles.push(style)); + } + type.__styles = useCssStyles(styles); + } + return type.__styles; +} + function isUndef(val) { return val === undefined || val === null; -} -function parseStylesheet(instance) { - return (instance.type.__stylesheet || - {}); } function patchAttr(el, key, value, instance = null) { if (instance) { - value = transformAttr(el, key, value, instance); + [key, value] = transformAttr(el, key, value, instance); } if (value == null) ; else { @@ -8927,21 +8952,22 @@ const CLASS_AND_STYLES = { }; function transformAttr(el, key, value, instance) { if (!value) { - return value; + return [key, value]; } const opts = CLASS_AND_STYLES[el.type]; if (opts) { - if (opts['class'].indexOf(key) !== -1) { - return parseStylesheet(instance)[value] || {}; + const camelized = camelize(key); + if (opts['class'].indexOf(camelized) > -1) { + return [camelized, parseStylesheet(instance)[value] || {}]; } - if (opts['style'].indexOf(key) !== -1) { + if (opts['style'].indexOf(key) > -1) { if (isString(value)) { - return parseStringStyle(value); + return [camelized, parseStringStyle(value)]; } - return normalizeStyle(value); + return [camelized, normalizeStyle(value)]; } } - return value; + return [key, value]; } // compiler should normalize class + :class bindings on the same element @@ -9203,4 +9229,4 @@ const createApp = ((...args) => { return app; }); -export { BaseTransition, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, computed$1 as computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineProps, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, initCustomFormatter, inject, injectHook, isInSSRComponentSetup, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, stop, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, version, warn$1 as warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withMemo, withScopeId }; +export { BaseTransition, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, computed$1 as computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineProps, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, initCustomFormatter, inject, injectHook, isInSSRComponentSetup, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, stop, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssStyles, useCssVars, useSSRContext, useSlots, useTransitionState, version, warn$1 as warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withMemo, withScopeId }; diff --git a/packages/uni-shared/dist/uni-shared.cjs.js b/packages/uni-shared/dist/uni-shared.cjs.js index 5bb85c9651bcea7d01c67570f29b7bc36247aadc..8b4516632e9bbbc2d8597cd4d95058fff26a50a8 100644 --- a/packages/uni-shared/dist/uni-shared.cjs.js +++ b/packages/uni-shared/dist/uni-shared.cjs.js @@ -585,18 +585,6 @@ function formatH5Log(type, filename, ...args) { console[type].apply(console, [...args, filename]); } -let latestNodeId = 1; -class NVueTextNode { - constructor(text) { - this.instanceId = ''; - this.nodeId = latestNodeId++; - this.parentNode = null; - this.nodeType = 3; - this.text = text; - this.children = []; - } -} - function plusReady(callback) { if (typeof callback !== 'function') { return; @@ -1345,7 +1333,6 @@ exports.NODE_TYPE_PAGE = NODE_TYPE_PAGE; exports.NODE_TYPE_TEXT = NODE_TYPE_TEXT; exports.NVUE_BUILT_IN_TAGS = NVUE_BUILT_IN_TAGS; exports.NVUE_U_BUILT_IN_TAGS = NVUE_U_BUILT_IN_TAGS; -exports.NVueTextNode = NVueTextNode; exports.ON_ADD_TO_FAVORITES = ON_ADD_TO_FAVORITES; exports.ON_APP_ENTER_BACKGROUND = ON_APP_ENTER_BACKGROUND; exports.ON_APP_ENTER_FOREGROUND = ON_APP_ENTER_FOREGROUND; diff --git a/packages/uni-shared/dist/uni-shared.d.ts b/packages/uni-shared/dist/uni-shared.d.ts index 9a790d7163a43a5af9510b6a288eaebda4818f75..3f7c13c707dbb3dc31748eafa6cd36bf73bd0b0b 100644 --- a/packages/uni-shared/dist/uni-shared.d.ts +++ b/packages/uni-shared/dist/uni-shared.d.ts @@ -323,6 +323,7 @@ export declare interface NVueDocument { open: () => void; close: () => void; createElement: (tagName: string, props?: Record) => NVueElement; + createText: (text: string) => Record; createComment: (text: string) => Record; fireEvent: (type: string) => void; destroy: () => void; @@ -395,16 +396,6 @@ export declare interface NVueTaskCenter { updateData: (componentId: string, data: Record | void, callback?: Function) => void; } -export declare class NVueTextNode { - instanceId: string; - nodeId: number; - parentNode: null | NVueElement; - nodeType: 3; - text: string; - children: unknown[]; - constructor(text: string); -} - export declare const ON_ADD_TO_FAVORITES = "onAddToFavorites"; export declare const ON_APP_ENTER_BACKGROUND = "onAppEnterBackground"; diff --git a/packages/uni-shared/dist/uni-shared.es.js b/packages/uni-shared/dist/uni-shared.es.js index f726888aae8a2d96ba4066120cbfe23f5dcd879f..94361fc79c6eb69beb7b463351955807b16a2a2b 100644 --- a/packages/uni-shared/dist/uni-shared.es.js +++ b/packages/uni-shared/dist/uni-shared.es.js @@ -581,18 +581,6 @@ function formatH5Log(type, filename, ...args) { console[type].apply(console, [...args, filename]); } -let latestNodeId = 1; -class NVueTextNode { - constructor(text) { - this.instanceId = ''; - this.nodeId = latestNodeId++; - this.parentNode = null; - this.nodeType = 3; - this.text = text; - this.children = []; - } -} - function plusReady(callback) { if (typeof callback !== 'function') { return; @@ -1300,4 +1288,4 @@ function getEnvLocale() { return (lang && lang.replace(/[.:].*/, '')) || 'en'; } -export { ACTION_TYPE_ADD_EVENT, ACTION_TYPE_ADD_WXS_EVENT, ACTION_TYPE_CREATE, ACTION_TYPE_EVENT, ACTION_TYPE_INSERT, ACTION_TYPE_PAGE_CREATE, ACTION_TYPE_PAGE_CREATED, ACTION_TYPE_PAGE_SCROLL, ACTION_TYPE_REMOVE, ACTION_TYPE_REMOVE_ATTRIBUTE, ACTION_TYPE_REMOVE_EVENT, ACTION_TYPE_SET_ATTRIBUTE, ACTION_TYPE_SET_TEXT, ATTR_CHANGE_PREFIX, ATTR_CLASS, ATTR_INNER_HTML, ATTR_STYLE, ATTR_TEXT_CONTENT, ATTR_V_OWNER_ID, ATTR_V_RENDERJS, ATTR_V_SHOW, BACKGROUND_COLOR, BUILT_IN_TAGS, BUILT_IN_TAG_NAMES, COMPONENT_NAME_PREFIX, COMPONENT_PREFIX, COMPONENT_SELECTOR_PREFIX, DATA_RE, EventChannel, EventModifierFlags, I18N_JSON_DELIMITERS, JSON_PROTOCOL, LINEFEED, MINI_PROGRAM_PAGE_RUNTIME_HOOKS, NAVBAR_HEIGHT, NODE_TYPE_COMMENT, NODE_TYPE_ELEMENT, NODE_TYPE_PAGE, NODE_TYPE_TEXT, NVUE_BUILT_IN_TAGS, NVUE_U_BUILT_IN_TAGS, NVueTextNode, ON_ADD_TO_FAVORITES, ON_APP_ENTER_BACKGROUND, ON_APP_ENTER_FOREGROUND, ON_BACK_PRESS, ON_ERROR, ON_HIDE, ON_KEYBOARD_HEIGHT_CHANGE, ON_LAUNCH, ON_LOAD, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, ON_PAGE_NOT_FOUND, ON_PAGE_SCROLL, ON_PULL_DOWN_REFRESH, ON_REACH_BOTTOM, ON_REACH_BOTTOM_DISTANCE, ON_READY, ON_RESIZE, ON_SHARE_APP_MESSAGE, ON_SHARE_TIMELINE, ON_SHOW, ON_TAB_ITEM_TAP, ON_THEME_CHANGE, ON_UNHANDLE_REJECTION, ON_UNLOAD, ON_WEB_INVOKE_APP_SERVICE, ON_WXS_INVOKE_CALL_METHOD, PLUS_RE, PRIMARY_COLOR, RENDERJS_MODULES, RESPONSIVE_MIN_WIDTH, SCHEME_RE, SELECTED_COLOR, SLOT_DEFAULT_NAME, TABBAR_HEIGHT, TAGS, UNI_SSR, UNI_SSR_DATA, UNI_SSR_GLOBAL_DATA, UNI_SSR_STORE, UNI_SSR_TITLE, UNI_STORAGE_LOCALE, UniBaseNode, UniCommentNode, UniElement, UniEvent, UniInputElement, UniLifecycleHooks, UniNode, UniTextAreaElement, UniTextNode, WEB_INVOKE_APPSERVICE, WXS_MODULES, WXS_PROTOCOL, addFont, addLeadingSlash, cache, cacheStringFunction, callOptions, createIsCustomElement, createRpx2Unit, createUniEvent, customizeEvent, debounce, decode, decodedQuery, defaultMiniProgramRpx2Unit, defaultNVueRpx2Unit, defaultRpx2Unit, dynamicSlotName, forcePatchProp, formatAppLog, formatDateTime, formatH5Log, formatLog, getCustomDataset, getEnvLocale, getLen, getValueByDataPath, initCustomDataset, invokeArrayFns, isAppNVueNativeTag, isAppNativeTag, isBuiltInComponent, isComponentInternalInstance, isComponentTag, isH5CustomElement, isH5NativeTag, isMiniProgramNativeTag, isRootHook, normalizeDataset, normalizeEventType, normalizeTarget, once, parseEventName, parseQuery, parseUrl, passive, plusReady, removeLeadingSlash, resolveComponentInstance, resolveOwnerEl, resolveOwnerVm, sanitise, scrollTo, stringifyQuery, updateElementStyle }; +export { ACTION_TYPE_ADD_EVENT, ACTION_TYPE_ADD_WXS_EVENT, ACTION_TYPE_CREATE, ACTION_TYPE_EVENT, ACTION_TYPE_INSERT, ACTION_TYPE_PAGE_CREATE, ACTION_TYPE_PAGE_CREATED, ACTION_TYPE_PAGE_SCROLL, ACTION_TYPE_REMOVE, ACTION_TYPE_REMOVE_ATTRIBUTE, ACTION_TYPE_REMOVE_EVENT, ACTION_TYPE_SET_ATTRIBUTE, ACTION_TYPE_SET_TEXT, ATTR_CHANGE_PREFIX, ATTR_CLASS, ATTR_INNER_HTML, ATTR_STYLE, ATTR_TEXT_CONTENT, ATTR_V_OWNER_ID, ATTR_V_RENDERJS, ATTR_V_SHOW, BACKGROUND_COLOR, BUILT_IN_TAGS, BUILT_IN_TAG_NAMES, COMPONENT_NAME_PREFIX, COMPONENT_PREFIX, COMPONENT_SELECTOR_PREFIX, DATA_RE, EventChannel, EventModifierFlags, I18N_JSON_DELIMITERS, JSON_PROTOCOL, LINEFEED, MINI_PROGRAM_PAGE_RUNTIME_HOOKS, NAVBAR_HEIGHT, NODE_TYPE_COMMENT, NODE_TYPE_ELEMENT, NODE_TYPE_PAGE, NODE_TYPE_TEXT, NVUE_BUILT_IN_TAGS, NVUE_U_BUILT_IN_TAGS, ON_ADD_TO_FAVORITES, ON_APP_ENTER_BACKGROUND, ON_APP_ENTER_FOREGROUND, ON_BACK_PRESS, ON_ERROR, ON_HIDE, ON_KEYBOARD_HEIGHT_CHANGE, ON_LAUNCH, ON_LOAD, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, ON_PAGE_NOT_FOUND, ON_PAGE_SCROLL, ON_PULL_DOWN_REFRESH, ON_REACH_BOTTOM, ON_REACH_BOTTOM_DISTANCE, ON_READY, ON_RESIZE, ON_SHARE_APP_MESSAGE, ON_SHARE_TIMELINE, ON_SHOW, ON_TAB_ITEM_TAP, ON_THEME_CHANGE, ON_UNHANDLE_REJECTION, ON_UNLOAD, ON_WEB_INVOKE_APP_SERVICE, ON_WXS_INVOKE_CALL_METHOD, PLUS_RE, PRIMARY_COLOR, RENDERJS_MODULES, RESPONSIVE_MIN_WIDTH, SCHEME_RE, SELECTED_COLOR, SLOT_DEFAULT_NAME, TABBAR_HEIGHT, TAGS, UNI_SSR, UNI_SSR_DATA, UNI_SSR_GLOBAL_DATA, UNI_SSR_STORE, UNI_SSR_TITLE, UNI_STORAGE_LOCALE, UniBaseNode, UniCommentNode, UniElement, UniEvent, UniInputElement, UniLifecycleHooks, UniNode, UniTextAreaElement, UniTextNode, WEB_INVOKE_APPSERVICE, WXS_MODULES, WXS_PROTOCOL, addFont, addLeadingSlash, cache, cacheStringFunction, callOptions, createIsCustomElement, createRpx2Unit, createUniEvent, customizeEvent, debounce, decode, decodedQuery, defaultMiniProgramRpx2Unit, defaultNVueRpx2Unit, defaultRpx2Unit, dynamicSlotName, forcePatchProp, formatAppLog, formatDateTime, formatH5Log, formatLog, getCustomDataset, getEnvLocale, getLen, getValueByDataPath, initCustomDataset, invokeArrayFns, isAppNVueNativeTag, isAppNativeTag, isBuiltInComponent, isComponentInternalInstance, isComponentTag, isH5CustomElement, isH5NativeTag, isMiniProgramNativeTag, isRootHook, normalizeDataset, normalizeEventType, normalizeTarget, once, parseEventName, parseQuery, parseUrl, passive, plusReady, removeLeadingSlash, resolveComponentInstance, resolveOwnerEl, resolveOwnerVm, sanitise, scrollTo, stringifyQuery, updateElementStyle }; diff --git a/packages/uni-shared/src/nvue.ts b/packages/uni-shared/src/nvue.ts index 809b3012afa829d9e18a29b44d59256b166257f8..87b4ed57bff8b00af867ae8d34c1f15e59da3b91 100644 --- a/packages/uni-shared/src/nvue.ts +++ b/packages/uni-shared/src/nvue.ts @@ -1,24 +1,5 @@ import { createApp, ComponentPublicInstance } from 'vue' -let latestNodeId = 1 - -export class NVueTextNode { - instanceId: string - nodeId: number - parentNode: null | NVueElement - nodeType: 3 - text: string - children: unknown[] - constructor(text: string) { - this.instanceId = '' - this.nodeId = latestNodeId++ - this.parentNode = null - this.nodeType = 3 - this.text = text - this.children = [] - } -} - export interface Vue { createApp: typeof createApp } @@ -91,6 +72,7 @@ export interface NVueDocument { tagName: string, props?: Record ) => NVueElement + createText: (text: string) => Record createComment: (text: string) => Record fireEvent: (type: string) => void destroy: () => void diff --git a/packages/vite-plugin-uni/src/index.ts b/packages/vite-plugin-uni/src/index.ts index 43f22cd1c89fd673ba4e380bbb3124579b1446c6..250e806884974944cd64fb94aa52c5487629162a 100644 --- a/packages/vite-plugin-uni/src/index.ts +++ b/packages/vite-plugin-uni/src/index.ts @@ -81,8 +81,8 @@ export default function uniPlugin( initPreContext(options.platform, process.env.UNI_CUSTOM_CONTEXT) const plugins: Plugin[] = [] - - if (options.viteLegacyOptions) { + // ไป…้™ h5 + if (options.viteLegacyOptions && options.platform === 'h5') { plugins.push( ...(legacyPlugin( initPluginViteLegacyOptions(options)