File tree 3 files changed +35
-16
lines changed
3 files changed +35
-16
lines changed Original file line number Diff line number Diff line change @@ -396,7 +396,23 @@ registerElement(
396
396
)
397
397
registerElement (
398
398
'FormattedString' ,
399
- ( ) => require ( '@nativescript/core/text/formatted-string' ) . FormattedString
399
+ ( ) => require ( '@nativescript/core/text/formatted-string' ) . FormattedString ,
400
+ {
401
+ insertChild ( parentNode , childNode , atIndex ) {
402
+ if ( atIndex ) {
403
+ parentNode . nativeView . spans . splice ( atIndex , 0 , childNode . nativeView )
404
+ return
405
+ }
406
+ parentNode . nativeView . spans . push ( childNode . nativeView )
407
+ } ,
408
+ removeChild ( parentNode , childNode ) {
409
+ const index = parentNode . nativeView . spans . indexOf ( childNode . nativeView )
410
+
411
+ if ( index > - 1 ) {
412
+ parentNode . nativeView . spans . splice ( index , 1 )
413
+ }
414
+ }
415
+ }
400
416
)
401
417
registerElement ( 'Span' , ( ) => require ( '@nativescript/core/text/span' ) . Span )
402
418
Original file line number Diff line number Diff line change 1
- let View ;
1
+ let View
2
2
export function isView ( view ) {
3
- if ( ! View ) {
3
+ if ( ! View ) {
4
4
View = require ( '@nativescript/core/ui/core/view' ) . View
5
5
}
6
6
return view instanceof View
7
7
}
8
8
9
-
10
- let LayoutBase ;
9
+ let LayoutBase
11
10
export function isLayout ( view ) {
12
- if ( ! LayoutBase ) {
11
+ if ( ! LayoutBase ) {
13
12
LayoutBase = require ( '@nativescript/core/ui/layouts/layout-base' ) . LayoutBase
14
13
}
15
- return (
16
- view instanceof LayoutBase
17
- )
14
+ return view instanceof LayoutBase
18
15
}
19
16
20
- let ContentView ;
17
+ let ContentView
21
18
export function isContentView ( view ) {
22
- if ( ! ContentView ) {
19
+ if ( ! ContentView ) {
23
20
ContentView = require ( '@nativescript/core/ui/content-view' ) . ContentView
24
21
}
25
- return (
26
- view instanceof ContentView
27
- )
22
+ return view instanceof ContentView
28
23
}
29
24
30
25
export function insertChild ( parentNode , childNode , atIndex = - 1 ) {
Original file line number Diff line number Diff line change 1
1
const Vue = require ( 'nativescript-vue' )
2
2
3
+ Vue . config . silent = false
4
+
3
5
new Vue ( {
4
6
template : `
5
7
<Frame>
6
8
<Page>
7
- <Label>
9
+ <Label @tap="toggle = !toggle" >
8
10
<FormattedString>
9
11
<Span text="some" fontWeight="Bold" />
10
12
<Span text="content" />
13
+ <Span v-if="toggle" text="toggled span" color="red" />
11
14
</FormattedString>
12
15
</Label>
13
16
</Page>
14
17
</Frame>
15
18
` ,
16
19
17
- comments : true
20
+ comments : true ,
21
+ data ( ) {
22
+ return {
23
+ toggle : false
24
+ }
25
+ }
18
26
} ) . $start ( )
You can’t perform that action at this time.
0 commit comments