提交 849687ff 编写于 作者: fxy060608's avatar fxy060608

build uni runtime (extends,mixins 支持 props )

上级 8308f875
......@@ -366,9 +366,33 @@ function createObserver (name) {
}
}
function getProperties (props) {
const properties = {
vueSlots: { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
function getBehaviors (vueExtends, vueMixins) {
const behaviors = [];
if (isPlainObject(vueExtends) && vueExtends.props) {
behaviors.push(
Behavior({
properties: getProperties(vueExtends.props, true)
})
);
}
if (Array.isArray(vueMixins)) {
vueMixins.forEach(vueMixin => {
if (isPlainObject(vueMixin) && vueMixin.props) {
behaviors.push(
Behavior({
properties: getProperties(vueMixin.props, true)
})
);
}
});
}
return behaviors
}
function getProperties (props, isBehavior = false) {
const properties = {};
if (!isBehavior) {
properties.vueSlots = { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
type: null,
value: [],
observer: function (newVal, oldVal) {
......@@ -380,8 +404,8 @@ function getProperties (props) {
$slots
});
}
}
};
};
}
if (Array.isArray(props)) { // ['title']
props.forEach(key => {
properties[key] = {
......@@ -849,6 +873,8 @@ function createComponent (vueOptions) {
const properties = getProperties(vueOptions.props);
const behaviors = getBehaviors(vueOptions['extends'], vueOptions['mixins']);
const VueComponent = Vue.extend(vueOptions);
const componentOptions = {
......@@ -857,6 +883,7 @@ function createComponent (vueOptions) {
addGlobalClass: true
},
data: getData(vueOptions, Vue.prototype),
behaviors,
properties,
lifetimes: {
attached () {
......
{
"name": "@dcloudio/uni-app-plus",
"version": "0.0.220",
"version": "0.0.221",
"description": "uni-app app-plus",
"main": "dist/index.js",
"scripts": {
......
......@@ -501,9 +501,33 @@ function createObserver (name) {
}
}
function getProperties (props) {
const properties = {
vueSlots: { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
function getBehaviors (vueExtends, vueMixins) {
const behaviors = [];
if (isPlainObject(vueExtends) && vueExtends.props) {
behaviors.push(
Behavior({
properties: getProperties(vueExtends.props, true)
})
);
}
if (Array.isArray(vueMixins)) {
vueMixins.forEach(vueMixin => {
if (isPlainObject(vueMixin) && vueMixin.props) {
behaviors.push(
Behavior({
properties: getProperties(vueMixin.props, true)
})
);
}
});
}
return behaviors
}
function getProperties (props, isBehavior = false) {
const properties = {};
if (!isBehavior) {
properties.vueSlots = { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
type: null,
value: [],
observer: function (newVal, oldVal) {
......@@ -515,8 +539,8 @@ function getProperties (props) {
$slots
});
}
}
};
};
}
if (Array.isArray(props)) { // ['title']
props.forEach(key => {
properties[key] = {
......@@ -1016,6 +1040,8 @@ function createComponent (vueOptions) {
const properties = getProperties(vueOptions.props);
const behaviors = getBehaviors(vueOptions['extends'], vueOptions['mixins']);
const VueComponent = Vue.extend(vueOptions);
const componentOptions = {
......@@ -1024,6 +1050,7 @@ function createComponent (vueOptions) {
addGlobalClass: true
},
data: getData(vueOptions, Vue.prototype),
behaviors,
properties,
lifetimes: {
attached () {
......
{
"name": "@dcloudio/uni-mp-baidu",
"version": "0.0.815",
"version": "0.0.816",
"description": "uni-app mp-baidu",
"main": "dist/index.js",
"scripts": {
......
......@@ -546,9 +546,33 @@ function createObserver (name) {
}
}
function getProperties (props) {
const properties = {
vueSlots: { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
function getBehaviors (vueExtends, vueMixins) {
const behaviors = [];
if (isPlainObject(vueExtends) && vueExtends.props) {
behaviors.push(
Behavior({
properties: getProperties(vueExtends.props, true)
})
);
}
if (Array.isArray(vueMixins)) {
vueMixins.forEach(vueMixin => {
if (isPlainObject(vueMixin) && vueMixin.props) {
behaviors.push(
Behavior({
properties: getProperties(vueMixin.props, true)
})
);
}
});
}
return behaviors
}
function getProperties (props, isBehavior = false) {
const properties = {};
if (!isBehavior) {
properties.vueSlots = { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
type: null,
value: [],
observer: function (newVal, oldVal) {
......@@ -560,8 +584,8 @@ function getProperties (props) {
$slots
});
}
}
};
};
}
if (Array.isArray(props)) { // ['title']
props.forEach(key => {
properties[key] = {
......@@ -1040,6 +1064,8 @@ function createComponent (vueOptions) {
const properties = getProperties(vueOptions.props);
const behaviors = getBehaviors(vueOptions['extends'], vueOptions['mixins']);
const VueComponent = Vue.extend(vueOptions);
const componentOptions = {
......@@ -1048,6 +1074,7 @@ function createComponent (vueOptions) {
addGlobalClass: true
},
data: getData(vueOptions, Vue.prototype),
behaviors,
properties,
lifetimes: {
attached () {
......
{
"name": "@dcloudio/uni-mp-toutiao",
"version": "0.0.315",
"version": "0.0.316",
"description": "uni-app mp-toutiao",
"main": "dist/index.js",
"scripts": {
......
......@@ -393,9 +393,33 @@ function createObserver (name) {
}
}
function getProperties (props) {
const properties = {
vueSlots: { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
function getBehaviors (vueExtends, vueMixins) {
const behaviors = [];
if (isPlainObject(vueExtends) && vueExtends.props) {
behaviors.push(
Behavior({
properties: getProperties(vueExtends.props, true)
})
);
}
if (Array.isArray(vueMixins)) {
vueMixins.forEach(vueMixin => {
if (isPlainObject(vueMixin) && vueMixin.props) {
behaviors.push(
Behavior({
properties: getProperties(vueMixin.props, true)
})
);
}
});
}
return behaviors
}
function getProperties (props, isBehavior = false) {
const properties = {};
if (!isBehavior) {
properties.vueSlots = { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
type: null,
value: [],
observer: function (newVal, oldVal) {
......@@ -407,8 +431,8 @@ function getProperties (props) {
$slots
});
}
}
};
};
}
if (Array.isArray(props)) { // ['title']
props.forEach(key => {
properties[key] = {
......@@ -869,6 +893,8 @@ function createComponent (vueOptions) {
const properties = getProperties(vueOptions.props);
const behaviors = getBehaviors(vueOptions['extends'], vueOptions['mixins']);
const VueComponent = Vue.extend(vueOptions);
const componentOptions = {
......@@ -877,6 +903,7 @@ function createComponent (vueOptions) {
addGlobalClass: true
},
data: getData(vueOptions, Vue.prototype),
behaviors,
properties,
lifetimes: {
attached () {
......
{
"name": "@dcloudio/uni-mp-weixin",
"version": "0.0.939",
"version": "0.0.940",
"description": "uni-app mp-weixin",
"main": "dist/index.js",
"scripts": {
......
......@@ -9,6 +9,7 @@ import {
import {
getData,
handleEvent,
getBehaviors,
getProperties
} from './util'
......@@ -44,6 +45,8 @@ export function createComponent (vueOptions) {
const properties = getProperties(vueOptions.props)
const behaviors = getBehaviors(vueOptions['extends'], vueOptions['mixins'])
const VueComponent = Vue.extend(vueOptions)
const componentOptions = {
......@@ -52,6 +55,7 @@ export function createComponent (vueOptions) {
addGlobalClass: true
},
data: getData(vueOptions, Vue.prototype),
behaviors,
properties,
lifetimes: {
attached () {
......
......@@ -62,9 +62,33 @@ function createObserver (name) {
}
}
export function getProperties (props) {
const properties = {
vueSlots: { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
export function getBehaviors (vueExtends, vueMixins) {
const behaviors = []
if (isPlainObject(vueExtends) && vueExtends.props) {
behaviors.push(
Behavior({
properties: getProperties(vueExtends.props, true)
})
)
}
if (Array.isArray(vueMixins)) {
vueMixins.forEach(vueMixin => {
if (isPlainObject(vueMixin) && vueMixin.props) {
behaviors.push(
Behavior({
properties: getProperties(vueMixin.props, true)
})
)
}
})
}
return behaviors
}
export function getProperties (props, isBehavior = false) {
const properties = {}
if (!isBehavior) {
properties.vueSlots = { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
type: null,
value: [],
observer: function (newVal, oldVal) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册