提交 56ff1c98 编写于 作者: fxy060608's avatar fxy060608

wip(app): nvue

上级 7cd502ff
...@@ -11015,7 +11015,10 @@ export function nvueFactory(exports, document) { ...@@ -11015,7 +11015,10 @@ export function nvueFactory(exports, document) {
styles.push(appContext.provides.__appStyles); styles.push(appContext.provides.__appStyles);
} }
if (isArray(type.styles)) {
type.styles.forEach(style => styles.push(style)); type.styles.forEach(style => styles.push(style));
}
type.__styles = useCssStyles(styles); type.__styles = useCssStyles(styles);
} }
...@@ -11038,13 +11041,13 @@ export function nvueFactory(exports, document) { ...@@ -11038,13 +11041,13 @@ export function nvueFactory(exports, document) {
} }
} }
var ATTR_HOVER_CLASS = 'hover-class'; var ATTR_HOVER_CLASS = 'hoverClass';
var ATTR_PLACEHOLDER_CLASS = 'placeholder-class'; var ATTR_PLACEHOLDER_CLASS = 'placeholderClass';
var ATTR_PLACEHOLDER_STYLE = 'placeholder-style'; var ATTR_PLACEHOLDER_STYLE = 'placeholderStyle';
var ATTR_INDICATOR_CLASS = 'indicator-class'; var ATTR_INDICATOR_CLASS = 'indicatorClass';
var ATTR_INDICATOR_STYLE = 'indicator-style'; var ATTR_INDICATOR_STYLE = 'indicatorStyle';
var ATTR_MASK_CLASS = 'mask-class'; var ATTR_MASK_CLASS = 'maskClass';
var ATTR_MASK_STYLE = 'mask-style'; var ATTR_MASK_STYLE = 'maskStyle';
var CLASS_AND_STYLES = { var CLASS_AND_STYLES = {
view: { view: {
class: [ATTR_HOVER_CLASS], class: [ATTR_HOVER_CLASS],
...@@ -11080,16 +11083,18 @@ export function nvueFactory(exports, document) { ...@@ -11080,16 +11083,18 @@ export function nvueFactory(exports, document) {
var opts = CLASS_AND_STYLES[el.type]; var opts = CLASS_AND_STYLES[el.type];
if (opts) { if (opts) {
if (opts['class'].indexOf(key) !== -1) { var camelized = camelize(key);
return [camelize(key), parseStylesheet(instance)[value] || {}];
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)) { if (isString(value)) {
return [camelize(key), parseStringStyle(value)]; return [camelized, parseStringStyle(value)];
} }
return [camelize(key), normalizeStyle(value)]; return [camelized, normalizeStyle(value)];
} }
} }
......
...@@ -9190,7 +9190,10 @@ export function nvueFactory(exports, document) { ...@@ -9190,7 +9190,10 @@ export function nvueFactory(exports, document) {
styles.push(appContext.provides.__appStyles); styles.push(appContext.provides.__appStyles);
} }
if (isArray(type.styles)) {
type.styles.forEach(style => styles.push(style)); type.styles.forEach(style => styles.push(style));
}
type.__styles = useCssStyles(styles); type.__styles = useCssStyles(styles);
} }
...@@ -9213,13 +9216,13 @@ export function nvueFactory(exports, document) { ...@@ -9213,13 +9216,13 @@ export function nvueFactory(exports, document) {
} }
} }
var ATTR_HOVER_CLASS = 'hover-class'; var ATTR_HOVER_CLASS = 'hoverClass';
var ATTR_PLACEHOLDER_CLASS = 'placeholder-class'; var ATTR_PLACEHOLDER_CLASS = 'placeholderClass';
var ATTR_PLACEHOLDER_STYLE = 'placeholder-style'; var ATTR_PLACEHOLDER_STYLE = 'placeholderStyle';
var ATTR_INDICATOR_CLASS = 'indicator-class'; var ATTR_INDICATOR_CLASS = 'indicatorClass';
var ATTR_INDICATOR_STYLE = 'indicator-style'; var ATTR_INDICATOR_STYLE = 'indicatorStyle';
var ATTR_MASK_CLASS = 'mask-class'; var ATTR_MASK_CLASS = 'maskClass';
var ATTR_MASK_STYLE = 'mask-style'; var ATTR_MASK_STYLE = 'maskStyle';
var CLASS_AND_STYLES = { var CLASS_AND_STYLES = {
view: { view: {
class: [ATTR_HOVER_CLASS], class: [ATTR_HOVER_CLASS],
...@@ -9255,16 +9258,18 @@ export function nvueFactory(exports, document) { ...@@ -9255,16 +9258,18 @@ export function nvueFactory(exports, document) {
var opts = CLASS_AND_STYLES[el.type]; var opts = CLASS_AND_STYLES[el.type];
if (opts) { if (opts) {
if (opts['class'].indexOf(key) !== -1) { var camelized = camelize(key);
return [camelize(key), parseStylesheet(instance)[value] || {}];
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)) { if (isString(value)) {
return [camelize(key), parseStringStyle(value)]; return [camelized, parseStringStyle(value)];
} }
return [camelize(key), normalizeStyle(value)]; return [camelized, normalizeStyle(value)];
} }
} }
......
...@@ -8897,7 +8897,9 @@ function parseStylesheet({ type, vnode: { appContext } }) { ...@@ -8897,7 +8897,9 @@ function parseStylesheet({ type, vnode: { appContext } }) {
if (appContext) { if (appContext) {
styles.push(appContext.provides.__appStyles); styles.push(appContext.provides.__appStyles);
} }
if (isArray(type.styles)) {
type.styles.forEach(style => styles.push(style)); type.styles.forEach(style => styles.push(style));
}
type.__styles = useCssStyles(styles); type.__styles = useCssStyles(styles);
} }
return type.__styles; return type.__styles;
...@@ -8916,13 +8918,13 @@ function patchAttr(el, key, value, instance = null) { ...@@ -8916,13 +8918,13 @@ function patchAttr(el, key, value, instance = null) {
el.setAttr(key, value); el.setAttr(key, value);
} }
} }
const ATTR_HOVER_CLASS = 'hover-class'; const ATTR_HOVER_CLASS = 'hoverClass';
const ATTR_PLACEHOLDER_CLASS = 'placeholder-class'; const ATTR_PLACEHOLDER_CLASS = 'placeholderClass';
const ATTR_PLACEHOLDER_STYLE = 'placeholder-style'; const ATTR_PLACEHOLDER_STYLE = 'placeholderStyle';
const ATTR_INDICATOR_CLASS = 'indicator-class'; const ATTR_INDICATOR_CLASS = 'indicatorClass';
const ATTR_INDICATOR_STYLE = 'indicator-style'; const ATTR_INDICATOR_STYLE = 'indicatorStyle';
const ATTR_MASK_CLASS = 'mask-class'; const ATTR_MASK_CLASS = 'maskClass';
const ATTR_MASK_STYLE = 'mask-style'; const ATTR_MASK_STYLE = 'maskStyle';
const CLASS_AND_STYLES = { const CLASS_AND_STYLES = {
view: { view: {
class: [ATTR_HOVER_CLASS], class: [ATTR_HOVER_CLASS],
...@@ -8955,14 +8957,15 @@ function transformAttr(el, key, value, instance) { ...@@ -8955,14 +8957,15 @@ function transformAttr(el, key, value, instance) {
} }
const opts = CLASS_AND_STYLES[el.type]; const opts = CLASS_AND_STYLES[el.type];
if (opts) { if (opts) {
if (opts['class'].indexOf(key) !== -1) { const camelized = camelize(key);
return [camelize(key), parseStylesheet(instance)[value] || {}]; 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)) { if (isString(value)) {
return [camelize(key), parseStringStyle(value)]; return [camelized, parseStringStyle(value)];
} }
return [camelize(key), normalizeStyle(value)]; return [camelized, normalizeStyle(value)];
} }
} }
return [key, value]; return [key, value];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册