@@ -48,13 +48,13 @@ export default function model(name, value, output, node, locationInfo, options)
4848 /* eslint-disable no-eval */
4949 if ( ! isDynamicType ) {
5050 if ( tag === 'select' ) {
51- genSelectModel ( value , output )
51+ genSelectModel ( value , output , options )
5252 } else if ( tag === 'input' && type === 'checkbox' ) {
53- genCheckboxModel ( node , attrName , value , output )
53+ genCheckboxModel ( node , attrName , value , output , options )
5454 } else if ( tag === 'input' && type === 'radio' ) {
55- genRadioModel ( node , attrName , value , output )
55+ genRadioModel ( node , attrName , value , output , options )
5656 } else if ( tag === 'input' || tag === 'textarea' ) {
57- genDefaultModel ( attrName , value , output )
57+ genDefaultModel ( attrName , value , output , options )
5858 } else if (
5959 tag === 'component' ||
6060 ! validator . isReservedTag ( tag ) ||
@@ -64,7 +64,7 @@ export default function model(name, value, output, node, locationInfo, options)
6464 genComponentModel ( node , attrName , value , output , locationInfo , options )
6565 }
6666 } else {
67- genDynamicModel ( node , attrName , value , output , type )
67+ genDynamicModel ( node , attrName , value , output , type , options )
6868 }
6969}
7070
@@ -76,7 +76,7 @@ export default function model(name, value, output, node, locationInfo, options)
7676 * @param {object } output 构建的输出结果
7777 * @returns {object } 构建过程中生成的代码字符串组成的对象,供 genDynamicModel 使用
7878 */
79- function genCheckboxModel ( node , attrName , value , output ) {
79+ function genCheckboxModel ( node , attrName , value , output , options ) {
8080 const expValue = exp ( value , false )
8181 const valueBinding = getBindingAttr ( node , 'value' , true ) || 'null'
8282 const trueValueBinding = getBindingAttr ( node , 'true-value' , true ) || 'true'
@@ -102,7 +102,7 @@ function genCheckboxModel(node, attrName, value, output) {
102102 ${ expValue } = checked ? ${ trueValueBinding } : ${ falseValueBinding }
103103 }`
104104
105- const isNewJSCard = output . isNewJSCard
105+ const isNewJSCard = options . newJSCard
106106 if ( isNewJSCard ) {
107107 addAttr ( output . result , attrName , `(function() {${ attrCheckedCode } })` )
108108 addAttr ( output . result , attrName + 'Raw' , value )
@@ -125,13 +125,13 @@ function genCheckboxModel(node, attrName, value, output) {
125125 * @param {object } output 构建的输出结果
126126 * @returns {object } 构建过程中生成的代码字符串组成的对象,供 genDynamicModel 使用
127127 */
128- function genRadioModel ( node , attrName , value , output ) {
128+ function genRadioModel ( node , attrName , value , output , options ) {
129129 const valueBinding = getBindingAttr ( node , 'value' , true ) || 'null'
130130
131131 const attrCheckedCode = `return ${ exp ( value , false ) } === ${ valueBinding } `
132132 const eventChangeCode = `${ exp ( value , false ) } = ${ valueBinding } `
133133
134- const isNewJSCard = output . isNewJSCard
134+ const isNewJSCard = options . newJSCard
135135 if ( isNewJSCard ) {
136136 addAttr ( output . result , attrName , `(function() {${ attrCheckedCode } })` )
137137 addAttr ( output . result , attrName + 'Raw' , value )
@@ -152,8 +152,8 @@ function genRadioModel(node, attrName, value, output) {
152152 * @param {string } value model 绑定的值
153153 * @param {object } output 构建的输出结果
154154 */
155- function genSelectModel ( value , output ) {
156- const isNewJSCard = output . isNewJSCard
155+ function genSelectModel ( value , output , options ) {
156+ const isNewJSCard = options . newJSCard
157157 if ( isNewJSCard ) {
158158 addHandler ( output . result , 'change' , `function(evt) { ${ exp ( value , false ) } = evt.newValue}` )
159159 } else {
@@ -172,10 +172,10 @@ function genSelectModel(value, output) {
172172 * @param {object } output 构建的输出结果
173173 * @returns {object } 构建过程中生成的代码字符串组成的对象,供 genDynamicModel 使用
174174 */
175- function genDefaultModel ( attrName , value , output ) {
175+ function genDefaultModel ( attrName , value , output , options ) {
176176 const eventChangeCode = `${ exp ( value , false ) } = evt.target.value`
177- const isNewJSCard = output . isNewJSCard
178- const isLite = output . isLite
177+ const isNewJSCard = options . newJSCard
178+ const isLite = options . lite
179179 if ( isNewJSCard ) {
180180 addAttr ( output . result , attrName , exp ( value , true , isLite , isNewJSCard ) )
181181 addAttr ( output . result , attrName + 'Raw' , value )
@@ -200,7 +200,7 @@ function genComponentModel(node, attrName, value, output, locationInfo, options)
200200 // 自定义组件model指令绑定的属性,依然作为普通属性处理
201201 validator . checkAttr ( attrName , value , output , node . tagName , locationInfo , options )
202202
203- const isNewJSCard = output . isNewJSCard
203+ const isNewJSCard = options . newJSCard
204204 if ( isNewJSCard ) {
205205 addHandler (
206206 output . result ,
@@ -225,12 +225,12 @@ function genComponentModel(node, attrName, value, output, locationInfo, options)
225225 * @param {object } output 构建的输出结果
226226 * @param {string } expType type 属性绑定的值
227227 */
228- function genDynamicModel ( node , attrName , value , output , expType ) {
229- const checkboxCode = genCheckboxModel ( node , attrName , value , output )
230- const radioCode = genRadioModel ( node , attrName , value , output )
231- const textCode = genDefaultModel ( attrName , value , output )
232- const isNewJSCard = output . isNewJSCard
233- const isLite = output . isLite
228+ function genDynamicModel ( node , attrName , value , output , expType , options ) {
229+ const checkboxCode = genCheckboxModel ( node , attrName , value , output , options )
230+ const radioCode = genRadioModel ( node , attrName , value , output , options )
231+ const textCode = genDefaultModel ( attrName , value , output , options )
232+ const isNewJSCard = options . newJSCard
233+ const isLite = options . lite
234234 if ( isNewJSCard ) {
235235 addAttr ( output . result , attrName , exp ( value , true , isLite , isNewJSCard ) )
236236 addAttr ( output . result , attrName + 'Raw' , value )
0 commit comments