Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
D
default2
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yuri Bondarenko
default2
Commits
aeeb9c75
Commit
aeeb9c75
authored
Dec 29, 2018
by
Yuri Bondarenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
проба яндекс карт
parent
26c7bc1d
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
100 additions
and
30 deletions
+100
-30
package-lock.json
package-lock.json
+5
-0
package.json
package.json
+2
-1
src/assets/css/app.css
src/assets/css/app.css
+1
-0
src/assets/js/app.js
src/assets/js/app.js
+2
-0
src/components/component/index.js
src/components/component/index.js
+1
-2
src/components/swiper/index.js
src/components/swiper/index.js
+12
-9
src/components/swiper/swiper.css
src/components/swiper/swiper.css
+20
-18
src/components/ymaps/index.html
src/components/ymaps/index.html
+4
-0
src/components/ymaps/index.js
src/components/ymaps/index.js
+43
-0
src/components/ymaps/ymaps.css
src/components/ymaps/ymaps.css
+8
-0
src/index.html
src/index.html
+2
-0
No files found.
package-lock.json
View file @
aeeb9c75
...
...
@@ -17299,6 +17299,11 @@
"integrity"
:
"sha1-AI4G2AlDIMNy28L47XagymyKxBk="
,
"dev"
:
true
},
"ymaps"
:
{
"version"
:
"0.1.1"
,
"resolved"
:
"https://registry.npmjs.org/ymaps/-/ymaps-0.1.1.tgz"
,
"integrity"
:
"sha512-LCMgNCvPqRjwW4FWUT+Ly6T93W44OCYWFzFnTkUwMq0uy4B3VIRUN+uinX++idXtrJCnA/32FxEb/E505a0YUQ=="
},
"zopflipng-bin"
:
{
"version"
:
"4.1.0"
,
"resolved"
:
"https://registry.npmjs.org/zopflipng-bin/-/zopflipng-bin-4.1.0.tgz"
,
...
...
package.json
View file @
aeeb9c75
...
...
@@ -27,6 +27,7 @@
"
webpack-stream
"
:
"
^5.2.1
"
},
"dependencies"
:
{
"
swiper
"
:
"
^4.4.2
"
"
swiper
"
:
"
^4.4.2
"
,
"
ymaps
"
:
"
^0.1.1
"
}
}
src/assets/css/app.css
View file @
aeeb9c75
...
...
@@ -4,3 +4,4 @@
/* CSS */
@import
url('../../components/common/common.css')
;
@import
url('../../components/swiper/swiper.css')
;
@import
url('../../components/ymaps/ymaps.css')
;
src/assets/js/app.js
View file @
aeeb9c75
import
SwiperSlider
from
'
../../components/swiper
'
;
import
YMaps
from
'
../../components/ymaps
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
const
swiperSlider
=
new
SwiperSlider
();
const
ymaps
=
new
YMaps
();
});
\ No newline at end of file
src/components/component/index.js
View file @
aeeb9c75
...
...
@@ -33,8 +33,7 @@ export default class Component {
*/
setState
(
newState
=
{}
){
console
.
log
(
'
Component setState(): Compare states
'
,
this
.
objectEquals
(
this
.
state
,
newState
),
this
.
state
,
newState
);
// если состояния различаются - обновляем состояние и рендерим
if
(
!
this
.
objectEquals
(
this
.
state
,
newState
)
){
Object
.
assign
(
this
.
state
,
newState
);
this
.
render
();
...
...
src/components/swiper/index.js
View file @
aeeb9c75
...
...
@@ -34,10 +34,10 @@ export default class SwiperSlider extends Component {
}
){
super
(
props
);
this
.
loadData
();
}
/**
* загружаем данные
*/
...
...
@@ -113,14 +113,17 @@ export default class SwiperSlider extends Component {
});
}
render
(){
// console.log( this.state.slides );
/**
* рендерим свайпер
*/
render
(){
if
(
this
.
swiper
){
this
.
swiper
.
destroy
(
true
,
true
);
}
this
.
swiper
=
new
Swiper
(
this
.
props
.
selector
,
this
.
props
.
options
);
this
.
swiper
.
appendSlide
(
this
.
state
.
slides
);
console
.
log
(
'
Swiper class: render() called
'
);
}
...
...
src/components/swiper/swiper.css
View file @
aeeb9c75
...
...
@@ -14,6 +14,7 @@
/* NEW CSS */
@custom-media
--viewport-medium
(
width
<=
50rem
);
@custom-selector
:
--heading
h1
,
h2
,
h3
,
h4
,
h5
,
h6
;
:root
{
...
...
@@ -27,6 +28,7 @@ html {
}
@media
(
--viewport-medium
)
{
body
{
color
:
var
(
--mainColor
);
font-family
:
system-ui
;
...
...
src/components/ymaps/index.html
0 → 100644
View file @
aeeb9c75
<div
class=
"ymaps-container"
>
<h2>
Yandex Maps
</h2>
<div
id=
"map"
></div>
</div>
\ No newline at end of file
src/components/ymaps/index.js
0 → 100644
View file @
aeeb9c75
import
ymaps
from
'
ymaps
'
;
import
Component
from
'
../component
'
;
export
default
class
YMaps
extends
Component
{
constructor
(
props
=
{
selector
:
'
#map
'
,
lat
:
-
8.369326
,
lon
:
115.166023
}){
super
(
props
);
this
.
loadMap
();
}
/**
* Загружаем карту
*/
loadMap
(){
const
el
=
document
.
querySelector
(
this
.
props
.
selector
);
ymaps
.
load
(
'
//api-maps.yandex.ru/2.1/?lang=en_RU
'
).
then
(
maps
=>
{
this
.
state
.
mapInstance
=
new
maps
.
Map
(
el
,
{
center
:
[
parseFloat
(
this
.
props
.
lat
),
parseFloat
(
this
.
props
.
lon
)
]
});
})
.
catch
(
error
=>
console
.
log
(
'
Failed to load Yandex Maps
'
,
error
)
);
}
/**
*
*/
render
(){
return
false
;
}
}
\ No newline at end of file
src/components/ymaps/ymaps.css
0 → 100644
View file @
aeeb9c75
.ymaps-container
{
padding
:
50px
0
;
}
#map
{
width
:
600px
;
height
:
400px
;
}
\ No newline at end of file
src/index.html
View file @
aeeb9c75
...
...
@@ -16,6 +16,8 @@
@@include( './components/swiper/index.html' )
@@include( './components/ymaps/index.html' )
<script
src=
"https://cdn.polyfill.io/v2/polyfill.js?features=default,fetch"
></script>
<script
src=
"/assets/js/app.js?@@rev"
></script>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment