-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathvue.Rd
111 lines (103 loc) · 2.24 KB
/
vue.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/vue.R
\name{vue}
\alias{vue}
\title{'Vue.js' 'htmlwidget'}
\usage{
vue(
app = list(),
width = NULL,
height = NULL,
elementId = NULL,
minified = TRUE
)
}
\arguments{
\item{app}{\code{list} with \code{el} and \code{data} and other pieces
of a 'Vue.js' app}
\item{width, height}{any valid \code{CSS} size unit, but in reality
this will not currently have any impact}
\item{elementId}{\code{character} id of the htmlwidget container
element}
\item{minified}{\code{logical} to indicate minified (\code{minified=TRUE}) or
non-minified (\code{minified=FALSE}) Vue.js}
}
\value{
vue htmlwidget
}
\description{
Use 'Vue.js' with the convenience and flexibility of 'htmlwidgets'.
\code{vue} is a little different from other 'htmlwidgets' though
since it requires specification of the HTML tags/elements separately.
}
\examples{
if(interactive()) {
library(vueR)
library(htmltools)
# recreate Hello Vue! example
browsable(
tagList(
tags$div(id="app", "{{message}}"),
vue3(
list(
el = "#app",
data = list(
message = "Hello Vue!"
)
)
)
)
)
# app2 from Vue.js introduction
browsable(
tagList(
tags$div(id="app-2",
tags$span(
"v-bind:title" = "message",
"Hover your mouse over me for a few seconds to see my dynamically bound title!"
)
),
vue(
list(
el = "#app-2",
data = list(
message = htmlwidgets::JS(
"'You loaded this page on ' + new Date()"
)
)
)
)
)
)
# app3 from Vue.js introduction
# with a setInterval to toggle seen true and false
browsable(
tagList(
tags$div(id="app-3",
tags$p("v-if"="seen", "Now you see me")
),
htmlwidgets::onRender(
vue(
list(
el = '#app-3',
data = list(
seen = TRUE
)
)
),
"
function(el,x){
var that = this;
setInterval(function(){that.instance.seen=!that.instance.seen},1000);
}
"
)
)
)
}
}
\seealso{
Other htmlwidget:
\code{\link{vue3}()}
}
\concept{htmlwidget}