model.ts — vue Source File
Architecture documentation for model.ts, a typescript file in the vue codebase. 4 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 15390ccf_ab46_d508_a1ed_b3b87cc03914["model.ts"] 7937fbf2_2517_3f42_44b3_0dbdf16af5de["config"] 15390ccf_ab46_d508_a1ed_b3b87cc03914 --> 7937fbf2_2517_3f42_44b3_0dbdf16af5de a0ba3d1b_5fa2_9aa0_10cf_68e933ca762a["helpers"] 15390ccf_ab46_d508_a1ed_b3b87cc03914 --> a0ba3d1b_5fa2_9aa0_10cf_68e933ca762a 9f12235b_5462_7a1d_ed0d_cb6cc248ecf3["model"] 15390ccf_ab46_d508_a1ed_b3b87cc03914 --> 9f12235b_5462_7a1d_ed0d_cb6cc248ecf3 47ae9f26_59d1_fab2_349f_966f5d15495a["compiler"] 15390ccf_ab46_d508_a1ed_b3b87cc03914 --> 47ae9f26_59d1_fab2_349f_966f5d15495a bd1ea209_f0b6_a660_b088_32a9933f8c05["index.ts"] bd1ea209_f0b6_a660_b088_32a9933f8c05 --> 15390ccf_ab46_d508_a1ed_b3b87cc03914 style 15390ccf_ab46_d508_a1ed_b3b87cc03914 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import config from 'core/config'
import { addHandler, addProp, getBindingAttr } from 'compiler/helpers'
import { genComponentModel, genAssignmentCode } from 'compiler/directives/model'
import { ASTDirective, ASTElement, ASTModifiers } from 'types/compiler'
let warn
// in some cases, the event used has to be determined at runtime
// so we used some reserved tokens during compile.
export const RANGE_TOKEN = '__r'
export const CHECKBOX_RADIO_TOKEN = '__c'
export default function model(
el: ASTElement,
dir: ASTDirective,
_warn: Function
): boolean | undefined {
warn = _warn
const value = dir.value
const modifiers = dir.modifiers
const tag = el.tag
const type = el.attrsMap.type
if (__DEV__) {
// inputs with type="file" are read only and setting the input's
// value will throw an error.
if (tag === 'input' && type === 'file') {
warn(
`<${el.tag} v-model="${value}" type="file">:\n` +
`File inputs are read only. Use a v-on:change listener instead.`,
el.rawAttrsMap['v-model']
)
}
}
if (el.component) {
genComponentModel(el, value, modifiers)
// component v-model doesn't need extra runtime
return false
} else if (tag === 'select') {
genSelect(el, value, modifiers)
} else if (tag === 'input' && type === 'checkbox') {
genCheckboxModel(el, value, modifiers)
} else if (tag === 'input' && type === 'radio') {
genRadioModel(el, value, modifiers)
} else if (tag === 'input' || tag === 'textarea') {
genDefaultModel(el, value, modifiers)
} else if (!config.isReservedTag(tag)) {
genComponentModel(el, value, modifiers)
// component v-model doesn't need extra runtime
return false
} else if (__DEV__) {
warn(
`<${el.tag} v-model="${value}">: ` +
`v-model is not supported on this element type. ` +
"If you are working with contenteditable, it's recommended to " +
'wrap a library dedicated for that purpose inside a custom component.',
el.rawAttrsMap['v-model']
)
}
// ... (122 more lines)
Domain
Subdomains
Dependencies
- compiler
- config
- helpers
- model
Imported By
Source
Frequently Asked Questions
What does model.ts do?
model.ts is a source file in the vue codebase, written in typescript. It belongs to the WebPlatform domain, WebCompiler subdomain.
What functions are defined in model.ts?
model.ts defines 5 function(s): genCheckboxModel, genDefaultModel, genRadioModel, genSelect, model.
What does model.ts depend on?
model.ts imports 4 module(s): compiler, config, helpers, model.
What files import model.ts?
model.ts is imported by 1 file(s): index.ts.
Where is model.ts in the architecture?
model.ts is located at src/platforms/web/compiler/directives/model.ts (domain: WebPlatform, subdomain: WebCompiler, directory: src/platforms/web/compiler/directives).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free