提交 4b016c1d 编写于 作者: fxy060608's avatar fxy060608

build(deps): bump vite from 2.0.1 to 2.0.5

上级 532e580d
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
"semver": "^7.3.4", "semver": "^7.3.4",
"ts-jest": "^26.4.4", "ts-jest": "^26.4.4",
"typescript": "^4.1.3", "typescript": "^4.1.3",
"vite": "^2.0.1", "vite": "^2.0.5",
"vue": "3.0.5", "vue": "3.0.5",
"yorkie": "^2.0.0" "yorkie": "^2.0.0"
} }
......
// 暂不提供通知所有 // 暂不提供通知所有
// function broadcast (componentName, eventName, ...params) { // function broadcast (componentName, eventName, ...params) {
// this.$children.forEach(child => { // this.$children.forEach(child => {
// const name = child.$options.name && child.$options.name.substr(1) // const name = child.$options.name && child.$options.name.substr(1)
// if (~componentName.indexOf(name)) { // if (~componentName.indexOf(name)) {
// child.$emit.apply(child, [eventName].concat(params)) // child.$emit.apply(child, [eventName].concat(params))
// } else { // } else {
// broadcast.apply(child, [componentName, eventName].concat([params])) // broadcast.apply(child, [componentName, eventName].concat([params]))
// } // }
// }) // })
// } // }
function broadcast(componentName, eventName, ...params) { function broadcast(componentName, eventName, ...params) {
const children = this.$children const children = this.$children
const len = children.length const len = children.length
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
const child = children[i] const child = children[i]
const name = child.$options.name && child.$options.name.substr(4) const name = child.$options.name && child.$options.name.substr(4)
if (~componentName.indexOf(name)) { if (~componentName.indexOf(name)) {
child.$emit.apply(child, [eventName].concat(params)) child.$emit.apply(child, [eventName].concat(params))
return false return false
} else { } else {
if ( if (
broadcast.apply(child, [componentName, eventName].concat([params])) === broadcast.apply(child, [componentName, eventName].concat([params])) ===
false false
) { ) {
return false return false
} }
} }
} }
} }
export default { export default {
methods: { methods: {
$dispatch(componentName, eventName, ...params) { $dispatch(componentName, eventName, ...params) {
if (typeof componentName === 'string') { console.log('$dispatch', componentName, eventName, params)
componentName = [componentName] // if (typeof componentName === 'string') {
} // componentName = [componentName]
let parent = this.$parent || this.$root // }
let name = parent.$options.name && parent.$options.name.substr(4) // let parent = this.$parent || this.$root
// let name = parent.$options.name && parent.$options.name.substr(4)
while (parent && (!name || !~componentName.indexOf(name))) {
parent = parent.$parent // while (parent && (!name || !~componentName.indexOf(name))) {
// parent = parent.$parent
if (parent) {
name = parent.$options.name && parent.$options.name.substr(4) // if (parent) {
} // name = parent.$options.name && parent.$options.name.substr(4)
} // }
if (parent) { // }
parent.$emit.apply(parent, [eventName].concat(params)) // if (parent) {
} // parent.$emit.apply(parent, [eventName].concat(params))
}, // }
$broadcast(componentName, eventName, ...params) { },
if (typeof componentName === 'string') { $broadcast(componentName, eventName, ...params) {
componentName = [componentName] if (typeof componentName === 'string') {
} componentName = [componentName]
broadcast.apply(this, [componentName, eventName].concat(params)) }
} broadcast.apply(this, [componentName, eventName].concat(params))
} },
} },
}
...@@ -2184,20 +2184,7 @@ function broadcast(componentName, eventName, ...params) { ...@@ -2184,20 +2184,7 @@ function broadcast(componentName, eventName, ...params) {
var emitter = { var emitter = {
methods: { methods: {
$dispatch(componentName, eventName, ...params) { $dispatch(componentName, eventName, ...params) {
if (typeof componentName === "string") { console.log("$dispatch", componentName, eventName, params);
componentName = [componentName];
}
let parent = this.$parent || this.$root;
let name = parent.$options.name && parent.$options.name.substr(4);
while (parent && (!name || !~componentName.indexOf(name))) {
parent = parent.$parent;
if (parent) {
name = parent.$options.name && parent.$options.name.substr(4);
}
}
if (parent) {
parent.$emit.apply(parent, [eventName].concat(params));
}
}, },
$broadcast(componentName, eventName, ...params) { $broadcast(componentName, eventName, ...params) {
if (typeof componentName === "string") { if (typeof componentName === "string") {
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
"peerDependencies": { "peerDependencies": {
"@dcloudio/uni-cli-shared": "^3.0.0", "@dcloudio/uni-cli-shared": "^3.0.0",
"@dcloudio/uni-shared": "^3.0.0", "@dcloudio/uni-shared": "^3.0.0",
"vite": "^2.0.1" "vite": "^2.0.5"
}, },
"devDependencies": { "devDependencies": {
"@types/sass": "^1.16.0" "@types/sass": "^1.16.0"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册