Skip to content

Commit

Permalink
feat: 增加setup事件
Browse files Browse the repository at this point in the history
  • Loading branch information
fyl080801 committed Jan 11, 2021
1 parent 7c5e03d commit ee4dc4f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 12 deletions.
20 changes: 10 additions & 10 deletions scripts/verify-commit-msg.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
const chalk = require("chalk");
const msgPath = process.env.GIT_PARAMS;
const msg = require("fs")
.readFileSync(msgPath, "utf-8")
.trim();
const chalk = require('chalk')
const msgPath = process.env.GIT_PARAMS
const msg = require('fs')
.readFileSync(msgPath, 'utf-8')
.trim()

const commitRE = /^(revert: )?(feat|fix|polish|docs|style|refactor|perf|test|workflow|ci|chore|types|build)(\(.+\))?: .{1,50}/;
const commitRE = /^(revert: )?(feat|fix|polish|docs|style|refactor|perf|test|workflow|ci|chore|types|build)(\(.+\))?: .{1,50}/

if (!commitRE.test(msg)) {
console.log();
console.log()
console.error(
` ${chalk.bgRed.white(" ERROR ")} ${chalk.red(
` ${chalk.bgRed.white(' ERROR ')} ${chalk.red(
`invalid commit message format.`
)}\n\n` +
chalk.red(
Expand All @@ -25,6 +25,6 @@ if (!commitRE.test(msg)) {
`npm run commit`
)} to interactively generate a commit message.\n`
)
);
process.exit(1);
)
process.exit(1)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
import { isArray } from 'lodash-es'

export default (field, options) => {
export const transform = (prop, owner) => {
const value = owner[prop]
if (
value &&
value.component &&
value.fieldOptions &&
value.fieldOptions.scopedSlot
) {
return () => {
return false
}
}

return false
}

export const provider = (field, options) => {
const { node, registry } = options

const provider = (field, context) => {
Expand Down
10 changes: 9 additions & 1 deletion src/views/ScopedSlot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
:components="components"
:listeners="listeners"
:options="options"
@setup="onSetup"
></v-jform>
</div>
</template>

<script>
import { provider, transform } from '../extends/scopedSlot'
export default {
data() {
return {
Expand Down Expand Up @@ -138,7 +141,6 @@ export default {
$arguments: {
idx: {
$type: 'bind',
$source: 'scope.$index'
},
list: { $type: 'bind', $source: 'model.list' }
Expand Down Expand Up @@ -201,6 +203,12 @@ export default {
],
options: {}
}
},
methods: {
onSetup(builder) {
builder.transform(transform)
builder.provider(provider)
}
}
}
</script>

0 comments on commit ee4dc4f

Please sign in to comment.