“94f68337b8c28bc76bc487fdb36abe76a34cc367”上不存在“extend/base/Baidu.php”
提交 f4759747 编写于 作者: fxy060608's avatar fxy060608

build uni runtime(mp-baidu:[String,Number],default:false=>Boolean)

上级 28abd0a5
...@@ -393,7 +393,7 @@ function getBehaviors (vueExtends, vueMixins) { ...@@ -393,7 +393,7 @@ function getBehaviors (vueExtends, vueMixins) {
return behaviors return behaviors
} }
function parsePropType (key, type, file) { function parsePropType (key, type, defaultValue, file) {
// [String]=>String // [String]=>String
if (Array.isArray(type) && type.length === 1) { if (Array.isArray(type) && type.length === 1) {
return type[0] return type[0]
...@@ -434,7 +434,7 @@ function getProperties (props, isBehavior = false, file = '') { ...@@ -434,7 +434,7 @@ function getProperties (props, isBehavior = false, file = '') {
value = value(); value = value();
} }
opts.type = parsePropType(key, opts.type, file); opts.type = parsePropType(key, opts.type, value, file);
properties[key] = { properties[key] = {
type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null, type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
...@@ -442,7 +442,7 @@ function getProperties (props, isBehavior = false, file = '') { ...@@ -442,7 +442,7 @@ function getProperties (props, isBehavior = false, file = '') {
observer: createObserver(key) observer: createObserver(key)
}; };
} else { // content:String } else { // content:String
const type = parsePropType(key, opts, file); const type = parsePropType(key, opts, null, file);
properties[key] = { properties[key] = {
type: PROP_TYPES.indexOf(type) !== -1 ? type : null, type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
observer: createObserver(key) observer: createObserver(key)
......
{ {
"name": "@dcloudio/uni-app-plus", "name": "@dcloudio/uni-app-plus",
"version": "0.0.224", "version": "0.0.225",
"description": "uni-app app-plus", "description": "uni-app app-plus",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -528,32 +528,25 @@ function getBehaviors (vueExtends, vueMixins) { ...@@ -528,32 +528,25 @@ function getBehaviors (vueExtends, vueMixins) {
return behaviors return behaviors
} }
function parsePropType (key, type, file) { function parsePropType (key, type, defaultValue, file) {
// [String]=>String // [String]=>String
if (Array.isArray(type) && type.length === 1) { if (Array.isArray(type) && type.length === 1) {
return type[0] return type[0]
} }
{ {
if ( if (
Array.isArray(type) && defaultValue === false &&
Array.isArray(type) &&
type.length === 2 && type.length === 2 &&
type.indexOf(String) !== -1 type.indexOf(String) !== -1 &&
type.indexOf(Boolean) !== -1
) { // [String,Boolean]=>Boolean ) { // [String,Boolean]=>Boolean
if (type.indexOf(Boolean) !== -1) { if (file) {
if (file) { console.warn(
console.warn( `props.${key}.type should use Boolean instead of [String,Boolean] at ${file}`
`props.${key}.type should use Boolean instead of [String,Boolean] . at ${file}` );
);
}
return Boolean
} else if (type.indexOf(Number) !== -1) {
if (file) {
console.warn(
`props.${key}.type should use String or Number instead of [String,Number]. at ${file}`
);
}
return String
} }
return Boolean
} }
} }
return type return type
...@@ -592,7 +585,7 @@ function getProperties (props, isBehavior = false, file = '') { ...@@ -592,7 +585,7 @@ function getProperties (props, isBehavior = false, file = '') {
value = value(); value = value();
} }
opts.type = parsePropType(key, opts.type, file); opts.type = parsePropType(key, opts.type, value, file);
properties[key] = { properties[key] = {
type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null, type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
...@@ -600,7 +593,7 @@ function getProperties (props, isBehavior = false, file = '') { ...@@ -600,7 +593,7 @@ function getProperties (props, isBehavior = false, file = '') {
observer: createObserver(key) observer: createObserver(key)
}; };
} else { // content:String } else { // content:String
const type = parsePropType(key, opts, file); const type = parsePropType(key, opts, null, file);
properties[key] = { properties[key] = {
type: PROP_TYPES.indexOf(type) !== -1 ? type : null, type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
observer: createObserver(key) observer: createObserver(key)
......
{ {
"name": "@dcloudio/uni-mp-baidu", "name": "@dcloudio/uni-mp-baidu",
"version": "0.0.820", "version": "0.0.822",
"description": "uni-app mp-baidu", "description": "uni-app mp-baidu",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -573,7 +573,7 @@ function getBehaviors (vueExtends, vueMixins) { ...@@ -573,7 +573,7 @@ function getBehaviors (vueExtends, vueMixins) {
return behaviors return behaviors
} }
function parsePropType (key, type, file) { function parsePropType (key, type, defaultValue, file) {
// [String]=>String // [String]=>String
if (Array.isArray(type) && type.length === 1) { if (Array.isArray(type) && type.length === 1) {
return type[0] return type[0]
...@@ -614,7 +614,7 @@ function getProperties (props, isBehavior = false, file = '') { ...@@ -614,7 +614,7 @@ function getProperties (props, isBehavior = false, file = '') {
value = value(); value = value();
} }
opts.type = parsePropType(key, opts.type, file); opts.type = parsePropType(key, opts.type, value, file);
properties[key] = { properties[key] = {
type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null, type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
...@@ -622,7 +622,7 @@ function getProperties (props, isBehavior = false, file = '') { ...@@ -622,7 +622,7 @@ function getProperties (props, isBehavior = false, file = '') {
observer: createObserver(key) observer: createObserver(key)
}; };
} else { // content:String } else { // content:String
const type = parsePropType(key, opts, file); const type = parsePropType(key, opts, null, file);
properties[key] = { properties[key] = {
type: PROP_TYPES.indexOf(type) !== -1 ? type : null, type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
observer: createObserver(key) observer: createObserver(key)
......
{ {
"name": "@dcloudio/uni-mp-toutiao", "name": "@dcloudio/uni-mp-toutiao",
"version": "0.0.319", "version": "0.0.320",
"description": "uni-app mp-toutiao", "description": "uni-app mp-toutiao",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -420,7 +420,7 @@ function getBehaviors (vueExtends, vueMixins) { ...@@ -420,7 +420,7 @@ function getBehaviors (vueExtends, vueMixins) {
return behaviors return behaviors
} }
function parsePropType (key, type, file) { function parsePropType (key, type, defaultValue, file) {
// [String]=>String // [String]=>String
if (Array.isArray(type) && type.length === 1) { if (Array.isArray(type) && type.length === 1) {
return type[0] return type[0]
...@@ -461,7 +461,7 @@ function getProperties (props, isBehavior = false, file = '') { ...@@ -461,7 +461,7 @@ function getProperties (props, isBehavior = false, file = '') {
value = value(); value = value();
} }
opts.type = parsePropType(key, opts.type, file); opts.type = parsePropType(key, opts.type, value, file);
properties[key] = { properties[key] = {
type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null, type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
...@@ -469,7 +469,7 @@ function getProperties (props, isBehavior = false, file = '') { ...@@ -469,7 +469,7 @@ function getProperties (props, isBehavior = false, file = '') {
observer: createObserver(key) observer: createObserver(key)
}; };
} else { // content:String } else { // content:String
const type = parsePropType(key, opts, file); const type = parsePropType(key, opts, null, file);
properties[key] = { properties[key] = {
type: PROP_TYPES.indexOf(type) !== -1 ? type : null, type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
observer: createObserver(key) observer: createObserver(key)
......
{ {
"name": "@dcloudio/uni-mp-weixin", "name": "@dcloudio/uni-mp-weixin",
"version": "0.0.943", "version": "0.0.944",
"description": "uni-app mp-weixin", "description": "uni-app mp-weixin",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -89,32 +89,25 @@ export function getBehaviors (vueExtends, vueMixins) { ...@@ -89,32 +89,25 @@ export function getBehaviors (vueExtends, vueMixins) {
return behaviors return behaviors
} }
function parsePropType (key, type, file) { function parsePropType (key, type, defaultValue, file) {
// [String]=>String // [String]=>String
if (Array.isArray(type) && type.length === 1) { if (Array.isArray(type) && type.length === 1) {
return type[0] return type[0]
} }
if (__PLATFORM__ === 'mp-baidu') { if (__PLATFORM__ === 'mp-baidu') {
if ( if (
Array.isArray(type) && defaultValue === false &&
Array.isArray(type) &&
type.length === 2 && type.length === 2 &&
type.indexOf(String) !== -1 type.indexOf(String) !== -1 &&
type.indexOf(Boolean) !== -1
) { // [String,Boolean]=>Boolean ) { // [String,Boolean]=>Boolean
if (type.indexOf(Boolean) !== -1) { if (file) {
if (file) { console.warn(
console.warn( `props.${key}.type should use Boolean instead of [String,Boolean] at ${file}`
`props.${key}.type should use Boolean instead of [String,Boolean] . at ${file}` )
)
}
return Boolean
} else if (type.indexOf(Number) !== -1) {
if (file) {
console.warn(
`props.${key}.type should use String or Number instead of [String,Number]. at ${file}`
)
}
return String
} }
return Boolean
} }
} }
return type return type
...@@ -153,7 +146,7 @@ export function getProperties (props, isBehavior = false, file = '') { ...@@ -153,7 +146,7 @@ export function getProperties (props, isBehavior = false, file = '') {
value = value() value = value()
} }
opts.type = parsePropType(key, opts.type, file) opts.type = parsePropType(key, opts.type, value, file)
properties[key] = { properties[key] = {
type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null, type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
...@@ -161,7 +154,7 @@ export function getProperties (props, isBehavior = false, file = '') { ...@@ -161,7 +154,7 @@ export function getProperties (props, isBehavior = false, file = '') {
observer: createObserver(key) observer: createObserver(key)
} }
} else { // content:String } else { // content:String
const type = parsePropType(key, opts, file) const type = parsePropType(key, opts, null, file)
properties[key] = { properties[key] = {
type: PROP_TYPES.indexOf(type) !== -1 ? type : null, type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
observer: createObserver(key) observer: createObserver(key)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册