aboutsummaryrefslogtreecommitdiff
path: root/node_modules/vue/src/platforms/weex/compiler/modules/props.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/vue/src/platforms/weex/compiler/modules/props.js')
-rw-r--r--node_modules/vue/src/platforms/weex/compiler/modules/props.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/node_modules/vue/src/platforms/weex/compiler/modules/props.js b/node_modules/vue/src/platforms/weex/compiler/modules/props.js
new file mode 100644
index 00000000..8b0bb5f2
--- /dev/null
+++ b/node_modules/vue/src/platforms/weex/compiler/modules/props.js
@@ -0,0 +1,32 @@
+/* @flow */
+
+import { cached, camelize } from 'shared/util'
+
+const normalize = cached(camelize)
+
+function normalizeKeyName (str: string): string {
+ if (str.match(/^v\-/)) {
+ return str.replace(/(v-[a-z\-]+\:)([a-z\-]+)$/i, ($, directive, prop) => {
+ return directive + normalize(prop)
+ })
+ }
+ return normalize(str)
+}
+
+function transformNode (el: ASTElement, options: CompilerOptions) {
+ if (Array.isArray(el.attrsList)) {
+ el.attrsList.forEach(attr => {
+ if (attr.name && attr.name.match(/\-/)) {
+ const realName = normalizeKeyName(attr.name)
+ if (el.attrsMap) {
+ el.attrsMap[realName] = el.attrsMap[attr.name]
+ delete el.attrsMap[attr.name]
+ }
+ attr.name = realName
+ }
+ })
+ }
+}
+export default {
+ transformNode
+}