"import { createTextNode as _createTextNode } from 'vue/vapor';
export function render(_ctx) {
- const n0 = _createTextNode([1, 2])
+ const n0 = _createTextNode(() => [1, 2])
return n0
}"
`;
"import { createTextNode as _createTextNode } from 'vue/vapor';
export function render(_ctx) {
- const n0 = _createTextNode([1, 2, "3", 4, 5, "6", 7, 8, "9", 'A', 'B'])
+ const n0 = _createTextNode(() => [1, 2, "3", 4, 5, "6", 7, 8, "9", 'A', 'B'])
return n0
}"
`;
}"
`;
+exports[`compiler v-bind > number value 1`] = `
+"import { resolveComponent as _resolveComponent, createComponent as _createComponent } from 'vue/vapor';
+
+export function render(_ctx) {
+ const _component_Comp = _resolveComponent("Comp")
+ const n0 = _createComponent(_component_Comp, [
+ { depth: () => (0) }
+ ], null, true)
+ return n0
+}"
+`;
+
exports[`compiler v-bind > should error if empty expression 1`] = `
"import { setInheritAttrs as _setInheritAttrs, template as _template } from 'vue/vapor';
const t0 = _template("<div arg></div>")
expect(code).contains('renderEffect')
expect(code).contains('_setAttr(n0, "foo-bar", _ctx.fooBar, true)')
})
+
+ test('number value', () => {
+ const { code } = compileWithVBind(`<Comp :depth="0" />`)
+ expect(code).matchSnapshot()
+ expect(code).contains('{ depth: () => (0) }')
+ })
})
exp: SimpleExpressionNode,
): number | string | boolean | null {
if (exp.ast) {
- if (
- ['StringLiteral', 'NumericLiteral', 'BigIntLiteral'].includes(
- exp.ast.type,
- )
- ) {
+ if (exp.ast.type === 'StringLiteral') {
return (exp.ast as StringLiteral | NumericLiteral | BigIntLiteral).value
} else if (
exp.ast.type === 'TemplateLiteral' &&