提交 e9456f1e 编写于 作者: fxy060608's avatar fxy060608

wip(app): uni-app-plus

上级 1aaf8d7e
dist
\ No newline at end of file
dist
lib
\ No newline at end of file
......@@ -23,6 +23,9 @@ describe('dom', () => {
route: 'pages/index/index',
version: 1,
locale: 'zh_CN',
platform: 'ios',
pixelRatio: 1,
windowWidth: 375,
disableScroll: false,
onPageScroll: false,
onPageReachBottom: false,
......
......@@ -19,6 +19,9 @@ const defaultPageNodeOptions = {
route: 'pages/index/index',
version: 1,
locale: 'zh_CN',
platform: 'ios',
pixelRatio: 1,
windowWidth: 375,
disableScroll: false,
onPageScroll: false,
onPageReachBottom: false,
......
......@@ -115,6 +115,94 @@ uni-view {
uni-view[hidden] {
display: none;
}
uni-audio {
display: none;
}
uni-audio[controls] {
display: inline-block;
}
uni-audio[hidden] {
display: none;
}
.uni-audio-default {
max-width: 100%;
min-width: 302px;
height: 65px;
background: #fcfcfc;
border: 1px solid #e0e0e0;
border-radius: 2.5px;
display: inline-block;
overflow: hidden;
}
.uni-audio-left {
width: 65px;
height: 65px;
float: left;
background-color: #e6e6e6;
background-size: 100% 100%;
background-position: 50% 50%;
}
.uni-audio-button {
width: 24px;
height: 24px;
margin: 20.5px;
background-size: cover;
}
.uni-audio-button.play {
background-image: url(data:image/png;base64,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);
}
.uni-audio-button.pause {
background-image: url(data:image/png;base64,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);
}
.uni-audio-right {
box-sizing: border-box;
height: 65px;
margin-left: 65px;
padding: 11px 16.5px 13.5px 15px;
overflow: hidden;
}
.uni-audio-time {
margin-top: 3.5px;
height: 16.5px;
font-size: 12px;
color: #888888;
float: right;
}
.uni-audio-info {
margin-right: 70px;
overflow: hidden;
}
.uni-audio-name {
height: 22.5px;
line-height: 22.5px;
margin-bottom: 3.5px;
font-size: 14px;
color: #353535;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.uni-audio-author {
height: 14.5px;
line-height: 14.5px;
font-size: 12px;
color: #888888;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
uni-button {
position: relative;
display: block;
......@@ -379,3 +467,1344 @@ uni-button[loading][native]:before {
border-color: rgba(230, 67, 64, 0.6);
background-color: transparent;
}
uni-canvas {
width: 300px;
height: 150px;
display: block;
position: relative;
}
uni-canvas > .uni-canvas-canvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
uni-checkbox {
-webkit-tap-highlight-color: transparent;
display: inline-block;
cursor: pointer;
}
uni-checkbox[hidden] {
display: none;
}
uni-checkbox[disabled] {
cursor: not-allowed;
}
.uni-checkbox-wrapper {
display: inline-flex;
align-items: center;
vertical-align: middle;
}
.uni-checkbox-input {
margin-right: 5px;
-webkit-appearance: none;
appearance: none;
outline: 0;
border: 1px solid #d1d1d1;
background-color: #ffffff;
border-radius: 3px;
width: 22px;
height: 22px;
position: relative;
}
.uni-checkbox-input svg {
color: #007aff;
font-size: 22px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -48%) scale(0.73);
}
uni-checkbox:not([disabled]) .uni-checkbox-input:hover {
border-color: #007aff;
}
.uni-checkbox-input.uni-checkbox-input-disabled {
background-color: #e1e1e1;
}
.uni-checkbox-input.uni-checkbox-input-disabled:before {
color: #adadad;
}
uni-checkbox-group {
display: block;
}
uni-checkbox-group {
display: block;
}
uni-checkbox-group[hidden] {
display: none;
}
.ql-container {
display: block;
position: relative;
box-sizing: border-box;
-webkit-user-select: text;
user-select: text;
outline: none;
overflow: hidden;
width: 100%;
height: 200px;
min-height: 200px;
}
.ql-container[hidden] {
display: none;
}
.ql-container .ql-editor {
position: relative;
font-size: inherit;
line-height: inherit;
font-family: inherit;
min-height: inherit;
width: 100%;
height: 100%;
padding: 0;
overflow-x: hidden;
overflow-y: auto;
-webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none;
-webkit-overflow-scrolling: touch;
}
.ql-container .ql-editor::-webkit-scrollbar {
width: 0 !important;
}
.ql-container .ql-editor.scroll-disabled {
overflow: hidden;
}
.ql-container .ql-image-overlay {
display: flex;
position: absolute;
box-sizing: border-box;
border: 1px dashed #ccc;
justify-content: center;
align-items: center;
-webkit-user-select: none;
user-select: none;
}
.ql-container .ql-image-overlay .ql-image-size {
position: absolute;
padding: 4px 8px;
text-align: center;
background-color: #fff;
color: #888;
border: 1px solid #ccc;
box-sizing: border-box;
opacity: 0.8;
right: 4px;
top: 4px;
font-size: 12px;
display: inline-block;
width: auto;
}
.ql-container .ql-image-overlay .ql-image-toolbar {
position: relative;
text-align: center;
box-sizing: border-box;
background: #000;
border-radius: 5px;
color: #fff;
font-size: 0;
min-height: 24px;
z-index: 100;
}
.ql-container .ql-image-overlay .ql-image-toolbar span {
display: inline-block;
cursor: pointer;
padding: 5px;
font-size: 12px;
border-right: 1px solid #fff;
}
.ql-container .ql-image-overlay .ql-image-toolbar span:last-child {
border-right: 0;
}
.ql-container .ql-image-overlay .ql-image-toolbar span.triangle-up {
padding: 0;
position: absolute;
top: -12px;
left: 50%;
transform: translatex(-50%);
width: 0;
height: 0;
border-width: 6px;
border-style: solid;
border-color: transparent transparent black transparent;
}
.ql-container .ql-image-overlay .ql-image-handle {
position: absolute;
height: 12px;
width: 12px;
border-radius: 50%;
border: 1px solid #ccc;
box-sizing: border-box;
background: #fff;
}
.ql-container img {
display: inline-block;
max-width: 100%;
}
.ql-clipboard p {
margin: 0;
padding: 0;
}
.ql-editor {
box-sizing: border-box;
height: 100%;
outline: none;
overflow-y: auto;
tab-size: 4;
-moz-tab-size: 4;
text-align: left;
white-space: pre-wrap;
word-wrap: break-word;
}
.ql-editor > * {
cursor: text;
}
.ql-editor p,
.ql-editor ol,
.ql-editor ul,
.ql-editor pre,
.ql-editor blockquote,
.ql-editor h1,
.ql-editor h2,
.ql-editor h3,
.ql-editor h4,
.ql-editor h5,
.ql-editor h6 {
margin: 0;
padding: 0;
counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9;
}
.ql-editor ol > li,
.ql-editor ul > li {
list-style-type: none;
}
.ql-editor ul > li::before {
content: '\2022';
}
.ql-editor ul[data-checked=true],
.ql-editor ul[data-checked=false] {
pointer-events: none;
}
.ql-editor ul[data-checked=true] > li *,
.ql-editor ul[data-checked=false] > li * {
pointer-events: all;
}
.ql-editor ul[data-checked=true] > li::before,
.ql-editor ul[data-checked=false] > li::before {
color: #777;
cursor: pointer;
pointer-events: all;
}
.ql-editor ul[data-checked=true] > li::before {
content: '\2611';
}
.ql-editor ul[data-checked=false] > li::before {
content: '\2610';
}
.ql-editor li::before {
display: inline-block;
white-space: nowrap;
width: 2em;
}
.ql-editor ol li {
counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9;
counter-increment: list-0;
}
.ql-editor ol li:before {
content: counter(list-0, decimal) '. ';
}
.ql-editor ol li.ql-indent-1 {
counter-increment: list-1;
}
.ql-editor ol li.ql-indent-1:before {
content: counter(list-1, lower-alpha) '. ';
}
.ql-editor ol li.ql-indent-1 {
counter-reset: list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9;
}
.ql-editor ol li.ql-indent-2 {
counter-increment: list-2;
}
.ql-editor ol li.ql-indent-2:before {
content: counter(list-2, lower-roman) '. ';
}
.ql-editor ol li.ql-indent-2 {
counter-reset: list-3 list-4 list-5 list-6 list-7 list-8 list-9;
}
.ql-editor ol li.ql-indent-3 {
counter-increment: list-3;
}
.ql-editor ol li.ql-indent-3:before {
content: counter(list-3, decimal) '. ';
}
.ql-editor ol li.ql-indent-3 {
counter-reset: list-4 list-5 list-6 list-7 list-8 list-9;
}
.ql-editor ol li.ql-indent-4 {
counter-increment: list-4;
}
.ql-editor ol li.ql-indent-4:before {
content: counter(list-4, lower-alpha) '. ';
}
.ql-editor ol li.ql-indent-4 {
counter-reset: list-5 list-6 list-7 list-8 list-9;
}
.ql-editor ol li.ql-indent-5 {
counter-increment: list-5;
}
.ql-editor ol li.ql-indent-5:before {
content: counter(list-5, lower-roman) '. ';
}
.ql-editor ol li.ql-indent-5 {
counter-reset: list-6 list-7 list-8 list-9;
}
.ql-editor ol li.ql-indent-6 {
counter-increment: list-6;
}
.ql-editor ol li.ql-indent-6:before {
content: counter(list-6, decimal) '. ';
}
.ql-editor ol li.ql-indent-6 {
counter-reset: list-7 list-8 list-9;
}
.ql-editor ol li.ql-indent-7 {
counter-increment: list-7;
}
.ql-editor ol li.ql-indent-7:before {
content: counter(list-7, lower-alpha) '. ';
}
.ql-editor ol li.ql-indent-7 {
counter-reset: list-8 list-9;
}
.ql-editor ol li.ql-indent-8 {
counter-increment: list-8;
}
.ql-editor ol li.ql-indent-8:before {
content: counter(list-8, lower-roman) '. ';
}
.ql-editor ol li.ql-indent-8 {
counter-reset: list-9;
}
.ql-editor ol li.ql-indent-9 {
counter-increment: list-9;
}
.ql-editor ol li.ql-indent-9:before {
content: counter(list-9, decimal) '. ';
}
.ql-editor .ql-indent-1:not(.ql-direction-rtl) {
padding-left: 2em;
}
.ql-editor li.ql-indent-1:not(.ql-direction-rtl) {
padding-left: 2em;
}
.ql-editor .ql-indent-1.ql-direction-rtl.ql-align-right {
padding-right: 2em;
}
.ql-editor li.ql-indent-1.ql-direction-rtl.ql-align-right {
padding-right: 2em;
}
.ql-editor .ql-indent-2:not(.ql-direction-rtl) {
padding-left: 4em;
}
.ql-editor li.ql-indent-2:not(.ql-direction-rtl) {
padding-left: 4em;
}
.ql-editor .ql-indent-2.ql-direction-rtl.ql-align-right {
padding-right: 4em;
}
.ql-editor li.ql-indent-2.ql-direction-rtl.ql-align-right {
padding-right: 4em;
}
.ql-editor .ql-indent-3:not(.ql-direction-rtl) {
padding-left: 6em;
}
.ql-editor li.ql-indent-3:not(.ql-direction-rtl) {
padding-left: 6em;
}
.ql-editor .ql-indent-3.ql-direction-rtl.ql-align-right {
padding-right: 6em;
}
.ql-editor li.ql-indent-3.ql-direction-rtl.ql-align-right {
padding-right: 6em;
}
.ql-editor .ql-indent-4:not(.ql-direction-rtl) {
padding-left: 8em;
}
.ql-editor li.ql-indent-4:not(.ql-direction-rtl) {
padding-left: 8em;
}
.ql-editor .ql-indent-4.ql-direction-rtl.ql-align-right {
padding-right: 8em;
}
.ql-editor li.ql-indent-4.ql-direction-rtl.ql-align-right {
padding-right: 8em;
}
.ql-editor .ql-indent-5:not(.ql-direction-rtl) {
padding-left: 10em;
}
.ql-editor li.ql-indent-5:not(.ql-direction-rtl) {
padding-left: 10em;
}
.ql-editor .ql-indent-5.ql-direction-rtl.ql-align-right {
padding-right: 10em;
}
.ql-editor li.ql-indent-5.ql-direction-rtl.ql-align-right {
padding-right: 10em;
}
.ql-editor .ql-indent-6:not(.ql-direction-rtl) {
padding-left: 12em;
}
.ql-editor li.ql-indent-6:not(.ql-direction-rtl) {
padding-left: 12em;
}
.ql-editor .ql-indent-6.ql-direction-rtl.ql-align-right {
padding-right: 12em;
}
.ql-editor li.ql-indent-6.ql-direction-rtl.ql-align-right {
padding-right: 12em;
}
.ql-editor .ql-indent-7:not(.ql-direction-rtl) {
padding-left: 14em;
}
.ql-editor li.ql-indent-7:not(.ql-direction-rtl) {
padding-left: 14em;
}
.ql-editor .ql-indent-7.ql-direction-rtl.ql-align-right {
padding-right: 14em;
}
.ql-editor li.ql-indent-7.ql-direction-rtl.ql-align-right {
padding-right: 14em;
}
.ql-editor .ql-indent-8:not(.ql-direction-rtl) {
padding-left: 16em;
}
.ql-editor li.ql-indent-8:not(.ql-direction-rtl) {
padding-left: 16em;
}
.ql-editor .ql-indent-8.ql-direction-rtl.ql-align-right {
padding-right: 16em;
}
.ql-editor li.ql-indent-8.ql-direction-rtl.ql-align-right {
padding-right: 16em;
}
.ql-editor .ql-indent-9:not(.ql-direction-rtl) {
padding-left: 18em;
}
.ql-editor li.ql-indent-9:not(.ql-direction-rtl) {
padding-left: 18em;
}
.ql-editor .ql-indent-9.ql-direction-rtl.ql-align-right {
padding-right: 18em;
}
.ql-editor li.ql-indent-9.ql-direction-rtl.ql-align-right {
padding-right: 18em;
}
.ql-editor .ql-direction-rtl {
direction: rtl;
text-align: inherit;
}
.ql-editor .ql-align-center {
text-align: center;
}
.ql-editor .ql-align-justify {
text-align: justify;
}
.ql-editor .ql-align-right {
text-align: right;
}
.ql-editor.ql-blank::before {
color: rgba(0, 0, 0, 0.6);
content: attr(data-placeholder);
font-style: italic;
pointer-events: none;
position: absolute;
}
.ql-container.ql-disabled .ql-editor ul[data-checked] > li::before {
pointer-events: none;
}
.ql-clipboard {
left: -100000px;
height: 1px;
overflow-y: hidden;
position: absolute;
top: 50%;
}
uni-icon {
display: inline-block;
font-size: 0;
box-sizing: border-box;
}
uni-icon[hidden] {
display: none;
}
uni-image {
width: 320px;
height: 240px;
display: inline-block;
overflow: hidden;
position: relative;
}
uni-image[hidden] {
display: none;
}
uni-image > div {
width: 100%;
height: 100%;
}
uni-image > img {
-webkit-touch-callout: none;
-webkit-user-select: none;
user-select: none;
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
}
uni-image > .uni-image-will-change {
will-change: transform;
}
uni-input {
display: block;
font-size: 16px;
line-height: 1.4em;
height: 1.4em;
min-height: 1.4em;
overflow: hidden;
}
uni-input[hidden] {
display: none;
}
.uni-input-wrapper,
.uni-input-placeholder,
.uni-input-form,
.uni-input-input {
outline: none;
border: none;
padding: 0;
margin: 0;
text-decoration: inherit;
}
.uni-input-wrapper,
.uni-input-form {
display: flex;
position: relative;
width: 100%;
height: 100%;
flex-direction: column;
justify-content: center;
}
.uni-input-placeholder,
.uni-input-input {
width: 100%;
}
.uni-input-placeholder {
position: absolute;
top: auto !important;
left: 0;
color: gray;
overflow: hidden;
text-overflow: clip;
white-space: pre;
word-break: keep-all;
pointer-events: none;
line-height: inherit;
}
.uni-input-input {
position: relative;
display: block;
height: 100%;
background: none;
color: inherit;
opacity: 1;
font: inherit;
line-height: inherit;
letter-spacing: inherit;
text-align: inherit;
text-indent: inherit;
text-transform: inherit;
text-shadow: inherit;
}
.uni-input-input[type='search']::-webkit-search-cancel-button {
display: none;
}
.uni-input-input::-webkit-outer-spin-button,
.uni-input-input::-webkit-inner-spin-button {
-webkit-appearance: none;
appearance: none;
margin: 0;
}
.uni-input-input[type='number'] {
-moz-appearance: textfield;
}
.uni-input-input:disabled {
/* 用于重置iOS14以下禁用状态文字颜色 */
-webkit-text-fill-color: currentcolor;
}
.uni-label-pointer {
cursor: pointer;
}
uni-movable-area {
display: block;
position: relative;
width: 10px;
height: 10px;
}
uni-movable-area[hidden] {
display: none;
}
uni-movable-view {
display: inline-block;
width: 10px;
height: 10px;
top: 0px;
left: 0px;
position: absolute;
cursor: grab;
}
uni-movable-view[hidden] {
display: none;
}
uni-navigator {
height: auto;
width: auto;
display: block;
cursor: pointer;
}
uni-navigator[hidden] {
display: none;
}
.navigator-hover {
background-color: rgba(0, 0, 0, 0.1);
opacity: 0.7;
}
uni-picker-view {
display: block;
}
.uni-picker-view-wrapper {
display: flex;
position: relative;
overflow: hidden;
height: 100%;
}
uni-picker-view[hidden] {
display: none;
}
uni-picker-view-column {
flex: 1;
position: relative;
height: 100%;
overflow: hidden;
}
uni-picker-view-column[hidden] {
display: none;
}
.uni-picker-view-group {
height: 100%;
overflow: hidden;
}
.uni-picker-view-mask {
transform: translateZ(0);
}
.uni-picker-view-indicator,
.uni-picker-view-mask {
position: absolute;
left: 0;
width: 100%;
z-index: 3;
pointer-events: none;
}
.uni-picker-view-mask {
top: 0;
height: 100%;
margin: 0 auto;
background: linear-gradient(
180deg,
hsla(0, 0%, 100%, 0.95),
hsla(0, 0%, 100%, 0.6)
),
linear-gradient(0deg, hsla(0, 0%, 100%, 0.95), hsla(0, 0%, 100%, 0.6));
background-position: top, bottom;
background-size: 100% 102px;
background-repeat: no-repeat;
}
.uni-picker-view-indicator {
height: 34px;
/* top: 102px; */
top: 50%;
transform: translateY(-50%);
}
.uni-picker-view-content {
position: absolute;
top: 0;
left: 0;
width: 100%;
will-change: transform;
padding: 102px 0;
cursor: pointer;
}
.uni-picker-view-content > * {
height: 34px;
overflow: hidden;
}
.uni-picker-view-indicator:after,
.uni-picker-view-indicator:before {
content: ' ';
position: absolute;
left: 0;
right: 0;
height: 1px;
color: #e5e5e5;
}
.uni-picker-view-indicator:before {
top: 0;
border-top: 1px solid #e5e5e5;
transform-origin: 0 0;
transform: scaleY(0.5);
}
.uni-picker-view-indicator:after {
bottom: 0;
border-bottom: 1px solid #e5e5e5;
transform-origin: 0 100%;
transform: scaleY(0.5);
}
.uni-picker-view-indicator:after,
.uni-picker-view-indicator:before {
content: ' ';
position: absolute;
left: 0;
right: 0;
height: 1px;
color: #e5e5e5;
}
uni-progress {
display: flex;
align-items: center;
}
uni-progress[hidden] {
display: none;
}
.uni-progress-bar {
flex: 1;
}
.uni-progress-inner-bar {
width: 0;
height: 100%;
}
.uni-progress-info {
margin-top: 0;
margin-bottom: 0;
min-width: 2em;
margin-left: 15px;
font-size: 16px;
}
uni-radio {
-webkit-tap-highlight-color: transparent;
display: inline-block;
cursor: pointer;
}
uni-radio[hidden] {
display: none;
}
uni-radio[disabled] {
cursor: not-allowed;
}
.uni-radio-wrapper {
display: inline-flex;
align-items: center;
vertical-align: middle;
}
.uni-radio-input {
-webkit-appearance: none;
appearance: none;
margin-right: 5px;
outline: 0;
border: 1px solid #d1d1d1;
background-color: #ffffff;
border-radius: 50%;
width: 22px;
height: 22px;
position: relative;
}
uni-radio:not([disabled]) .uni-radio-input:hover {
border-color: #007aff;
}
.uni-radio-input svg {
color: #ffffff;
font-size: 18px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -48%) scale(0.73);
}
.uni-radio-input.uni-radio-input-disabled {
background-color: #e1e1e1;
border-color: #d1d1d1;
}
.uni-radio-input.uni-radio-input-disabled:before {
color: #adadad;
}
uni-radio-group {
display: block;
}
uni-radio-group[hidden] {
display: none;
}
uni-scroll-view {
display: block;
width: 100%;
}
uni-scroll-view[hidden] {
display: none;
}
.uni-scroll-view {
position: relative;
-webkit-overflow-scrolling: touch;
width: 100%;
/* display: flex; 时在安卓下会导致scrollWidth和offsetWidth一样 */
height: 100%;
max-height: inherit;
}
.uni-scroll-view-content {
width: 100%;
height: 100%;
}
.uni-scroll-view-refresher {
position: relative;
overflow: hidden;
}
.uni-scroll-view-refresh {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
.uni-scroll-view-refresh-inner {
display: flex;
align-items: center;
justify-content: center;
line-height: 0;
width: 40px;
height: 40px;
border-radius: 50%;
background-color: #fff;
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.117647),
0 1px 4px rgba(0, 0, 0, 0.117647);
}
.uni-scroll-view-refresh__spinner {
transform-origin: center center;
animation: uni-scroll-view-refresh-rotate 2s linear infinite;
}
.uni-scroll-view-refresh__spinner > circle {
stroke: currentColor;
stroke-linecap: round;
animation: uni-scroll-view-refresh-dash 2s linear infinite;
}
@keyframes uni-scroll-view-refresh-rotate {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes uni-scroll-view-refresh-dash {
0% {
stroke-dasharray: 1, 200;
stroke-dashoffset: 0;
}
50% {
stroke-dasharray: 89, 200;
stroke-dashoffset: -35px;
}
100% {
stroke-dasharray: 89, 200;
stroke-dashoffset: -124px;
}
}
uni-slider {
margin: 10px 18px;
padding: 0;
display: block;
}
uni-slider[hidden] {
display: none;
}
uni-slider .uni-slider-wrapper {
display: flex;
align-items: center;
min-height: 16px;
}
uni-slider .uni-slider-tap-area {
flex: 1;
padding: 8px 0;
}
uni-slider .uni-slider-handle-wrapper {
position: relative;
height: 2px;
border-radius: 5px;
background-color: #e9e9e9;
cursor: pointer;
transition: background-color 0.3s ease;
-webkit-tap-highlight-color: transparent;
}
uni-slider .uni-slider-track {
height: 100%;
border-radius: 6px;
background-color: #007aff;
transition: background-color 0.3s ease;
}
uni-slider .uni-slider-handle,
uni-slider .uni-slider-thumb {
position: absolute;
left: 50%;
top: 50%;
cursor: pointer;
border-radius: 50%;
transition: border-color 0.3s ease;
}
uni-slider .uni-slider-handle {
width: 28px;
height: 28px;
margin-top: -14px;
margin-left: -14px;
background-color: transparent;
z-index: 3;
cursor: grab;
}
uni-slider .uni-slider-thumb {
z-index: 2;
box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
}
uni-slider .uni-slider-step {
position: absolute;
width: 100%;
height: 2px;
background: transparent;
z-index: 1;
}
uni-slider .uni-slider-value {
width: 3ch;
color: #888;
font-size: 14px;
margin-left: 1em;
}
uni-slider .uni-slider-disabled .uni-slider-track {
background-color: #ccc;
}
uni-slider .uni-slider-disabled .uni-slider-thumb {
background-color: #fff;
border-color: #ccc;
}
uni-swiper {
display: block;
height: 150px;
}
uni-swiper[hidden] {
display: none;
}
.uni-swiper-wrapper {
overflow: hidden;
position: relative;
width: 100%;
height: 100%;
transform: translateZ(0);
}
.uni-swiper-slides {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
}
.uni-swiper-slide-frame {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
will-change: transform;
}
.uni-swiper-dots {
position: absolute;
font-size: 0;
}
.uni-swiper-dots-horizontal {
left: 50%;
bottom: 10px;
text-align: center;
white-space: nowrap;
transform: translate(-50%, 0);
}
.uni-swiper-dots-horizontal .uni-swiper-dot {
margin-right: 8px;
}
.uni-swiper-dots-horizontal .uni-swiper-dot:last-child {
margin-right: 0;
}
.uni-swiper-dots-vertical {
right: 10px;
top: 50%;
text-align: right;
transform: translate(0, -50%);
}
.uni-swiper-dots-vertical .uni-swiper-dot {
display: block;
margin-bottom: 9px;
}
.uni-swiper-dots-vertical .uni-swiper-dot:last-child {
margin-bottom: 0;
}
.uni-swiper-dot {
display: inline-block;
width: 8px;
height: 8px;
cursor: pointer;
transition-property: background-color;
transition-timing-function: ease;
background: rgba(0, 0, 0, 0.3);
border-radius: 50%;
}
.uni-swiper-dot-active {
background-color: #000000;
}
uni-swiper-item {
display: block;
overflow: hidden;
will-change: transform;
position: absolute;
width: 100%;
height: 100%;
cursor: grab;
}
uni-swiper-item[hidden] {
display: none;
}
uni-switch {
-webkit-tap-highlight-color: transparent;
display: inline-block;
cursor: pointer;
}
uni-switch[hidden] {
display: none;
}
uni-switch[disabled] {
cursor: not-allowed;
}
.uni-switch-wrapper {
display: inline-flex;
align-items: center;
vertical-align: middle;
}
.uni-switch-input {
-webkit-appearance: none;
appearance: none;
position: relative;
width: 52px;
height: 32px;
margin-right: 5px;
border: 1px solid #dfdfdf;
outline: 0;
border-radius: 16px;
box-sizing: border-box;
background-color: #dfdfdf;
transition: background-color 0.1s, border 0.1s;
}
uni-switch[disabled] .uni-switch-input {
opacity: 0.7;
}
.uni-switch-input:before {
content: ' ';
position: absolute;
top: 0;
left: 0;
width: 50px;
height: 30px;
border-radius: 15px;
background-color: #fdfdfd;
transition: transform 0.3s;
}
.uni-switch-input:after {
content: ' ';
position: absolute;
top: 0;
left: 0;
width: 30px;
height: 30px;
border-radius: 15px;
background-color: #ffffff;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
transition: transform 0.3s;
}
.uni-switch-input.uni-switch-input-checked {
border-color: #007aff;
background-color: #007aff;
}
.uni-switch-input.uni-switch-input-checked:before {
transform: scale(0);
}
.uni-switch-input.uni-switch-input-checked:after {
transform: translateX(20px);
}
uni-switch .uni-checkbox-input {
margin-right: 5px;
-webkit-appearance: none;
appearance: none;
outline: 0;
border: 1px solid #d1d1d1;
background-color: #ffffff;
border-radius: 3px;
width: 22px;
height: 22px;
position: relative;
color: #007aff;
}
uni-switch:not([disabled]) .uni-checkbox-input:hover {
border-color: #007aff;
}
uni-switch .uni-checkbox-input svg {
color: inherit;
font-size: 22px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -48%) scale(0.73);
}
.uni-checkbox-input.uni-checkbox-input-disabled {
background-color: #e1e1e1;
}
.uni-checkbox-input.uni-checkbox-input-disabled:before {
color: #adadad;
}
uni-text[selectable] {
cursor: auto;
-webkit-user-select: text;
user-select: text;
}
uni-textarea {
width: 300px;
height: 150px;
display: block;
position: relative;
font-size: 16px;
line-height: normal;
white-space: pre-wrap;
word-break: break-all;
box-sizing: content-box !important;
}
uni-textarea[hidden] {
display: none;
}
.uni-textarea-wrapper,
.uni-textarea-placeholder,
.uni-textarea-line,
.uni-textarea-compute,
.uni-textarea-textarea {
outline: none;
border: none;
padding: 0;
margin: 0;
text-decoration: inherit;
}
.uni-textarea-wrapper {
display: block;
position: relative;
width: 100%;
height: 100%;
min-height: inherit;
}
.uni-textarea-placeholder,
.uni-textarea-line,
.uni-textarea-compute,
.uni-textarea-textarea {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
white-space: inherit;
word-break: inherit;
}
.uni-textarea-placeholder {
color: grey;
overflow: hidden;
}
.uni-textarea-line,
.uni-textarea-compute {
visibility: hidden;
height: auto;
}
.uni-textarea-line {
width: 1em;
}
.uni-textarea-textarea {
resize: none;
background: none;
color: inherit;
opacity: 1;
font: inherit;
line-height: inherit;
letter-spacing: inherit;
text-align: inherit;
text-indent: inherit;
text-transform: inherit;
text-shadow: inherit;
}
/* 用于解决 iOS textarea 内部默认边距 */
.uni-textarea-textarea-fix-margin {
width: auto;
right: 0;
margin: 0 -3px;
}
.uni-textarea-textarea:disabled {
/* 用于重置iOS14以下禁用状态文字颜色 */
-webkit-text-fill-color: currentcolor;
}
uni-video {
width: 300px;
height: 225px;
display: inline-block;
line-height: 0;
overflow: hidden;
position: relative;
}
uni-video[hidden] {
display: none;
}
.uni-video-container {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
overflow: hidden;
background-color: black;
}
.uni-video-slot {
position: absolute;
top: 0;
width: 100%;
height: 100%;
overflow: hidden;
pointer-events: none;
}
......@@ -594,6 +594,23 @@ var serviceContext = (function (vue) {
return encode$3(arrayBuffer);
}, ArrayBufferToBase64Protocol);
/**
* 简易版systemInfo,主要为upx2px,i18n服务
* @returns
*/
function getBaseSystemInfo() {
// @ts-expect-error view 层
if (typeof __SYSTEM_INFO__ !== 'undefined') {
return window.__SYSTEM_INFO__;
}
const { resolutionWidth } = plus.screen.getCurrentSize();
return {
platform: (plus.os.name || '').toLowerCase(),
pixelRatio: plus.screen.scale,
windowWidth: Math.round(resolutionWidth),
};
}
function formatLog(module, ...args) {
return `[${Date.now()}][${module}]:${args
.map((arg) => JSON.stringify(arg))
......@@ -1556,6 +1573,7 @@ var serviceContext = (function (vue) {
}
function hasRpx(str) {
str = str + '';
return str.indexOf('rpx') !== -1 || str.indexOf('upx') !== -1;
}
function rpx2px(str, replace = false) {
......@@ -2454,6 +2472,35 @@ var serviceContext = (function (vue) {
timeout: Number,
};
const API_UPLOAD_FILE = 'uploadFile';
const UploadFileOptions = {
formatArgs: {
filePath(filePath, params) {
if (filePath) {
params.filePath = getRealPath(filePath);
}
},
header(value, params) {
params.header = value || {};
},
formData(value, params) {
params.formData = value || {};
},
},
};
const UploadFileProtocol = {
url: {
type: String,
required: true,
},
files: Array,
filePath: String,
name: String,
header: Object,
formData: Object,
timeout: Number,
};
const API_CONNECT_SOCKET = 'connectSocket';
const ConnectSocketOptions = {
formatArgs: {
......@@ -4517,32 +4564,13 @@ var serviceContext = (function (vue) {
});
});
this._socket.onerror(() => {
this.onErrorOrClose();
this.socketStateChange('error');
this.onErrorOrClose();
});
this._socket.onclose(() => {
this.onErrorOrClose();
this.socketStateChange('close');
this.onErrorOrClose();
});
const oldSocketSend = this._socket.send;
const oldSocketClose = this._socket.close;
this._socket.send = (res) => {
oldSocketSend(extend({
id: this.id,
data: typeof res.data === 'object'
? {
'@type': 'binary',
base64: arrayBufferToBase64(res.data),
}
: res.data,
}));
};
this._socket.close = (res) => {
oldSocketClose(extend({
id: this.id,
res,
}));
};
}
onErrorOrClose() {
this.readyState = this.CLOSED;
......@@ -4568,7 +4596,13 @@ var serviceContext = (function (vue) {
}
try {
this._socket.send({
data: args.data,
id: this.id,
data: typeof args.data === 'object'
? {
'@type': 'binary',
base64: arrayBufferToBase64(args.data),
}
: args.data,
});
callOptions(args, 'sendSocketMessage:ok');
}
......@@ -4579,7 +4613,10 @@ var serviceContext = (function (vue) {
close(args) {
this.readyState = this.CLOSING;
try {
this._socket.close(args);
this._socket.close(extend({
id: this.id,
args,
}));
callOptions(args, 'closeSocket:ok');
}
catch (error) {
......@@ -4626,9 +4663,7 @@ var serviceContext = (function (vue) {
reject('sendSocketMessage:fail WebSocket is not connected');
return;
}
socketTask._socket.send({
data: args.data,
});
socketTask.send({ data: args.data });
resolve();
}, SendSocketMessageProtocol);
const closeSocket = defineAsyncApi(API_CLOSE_SOCKET, (args, { resolve, reject }) => {
......@@ -4639,7 +4674,7 @@ var serviceContext = (function (vue) {
}
socketTask.readyState = socketTask.CLOSING;
const { code, reason } = args;
socketTask._socket.close({ code, reason });
socketTask.close({ code, reason });
resolve();
}, CloseSocketProtocol);
function on(event) {
......@@ -4653,6 +4688,84 @@ var serviceContext = (function (vue) {
const onSocketMessage = /*#__PURE__*/ on('message');
const onSocketClose = /*#__PURE__*/ on('close');
class UploadTask {
constructor(uploader) {
this._callbacks = [];
this._uploader = uploader;
uploader.addEventListener('statechanged', (upload, status) => {
if (upload.uploadedSize && upload.totalSize) {
this._callbacks.forEach((callback) => {
callback({
progress: parseInt(String((upload.uploadedSize / upload.totalSize) * 100)),
totalBytesSent: upload.uploadedSize,
totalBytesExpectedToSend: upload.totalSize,
});
});
}
});
}
abort() {
this._uploader.abort();
}
onProgressUpdate(callback) {
if (typeof callback !== 'function') {
return;
}
this._callbacks.push(callback);
}
onHeadersReceived() { }
offProgressUpdate(callback) {
const index = this._callbacks.indexOf(callback);
if (index >= 0) {
this._callbacks.splice(index, 1);
}
}
offHeadersReceived() { }
}
const uploadFile = defineTaskApi(API_UPLOAD_FILE, ({ url, timeout, header, formData, files, filePath, name }, { resolve, reject }) => {
const uploader = plus.uploader.createUpload(url, {
timeout,
// 需要与其它平台上的表现保持一致,不走重试的逻辑。
retry: 0,
retryInterval: 0,
}, (upload, statusCode) => {
if (statusCode) {
resolve({
data: upload.responseText,
statusCode,
});
}
else {
reject(`statusCode: ${statusCode}`);
}
});
for (const name in header) {
if (hasOwn$1(header, name)) {
uploader.setRequestHeader(name, String(header[name]));
}
}
for (const name in formData) {
if (hasOwn$1(formData, name)) {
uploader.addData(name, String(formData[name]));
}
}
if (files && files.length) {
files.forEach((file) => {
uploader.addFile(getRealPath(file.uri), {
key: file.name || 'file',
});
});
}
else {
uploader.addFile(getRealPath(filePath), {
key: name,
});
}
const uploadFileTask = new UploadTask(uploader);
uploader.start();
return uploadFileTask;
}, UploadFileProtocol, UploadFileOptions);
const audios = {};
const evts = [
'play',
......@@ -4698,7 +4811,7 @@ var serviceContext = (function (vue) {
};
function createAudioInstance() {
const audioId = `${Date.now()}${Math.random()}`;
const audio = (audios[audioId] = plus.audio.createPlayer());
const audio = (audios[audioId] = plus.audio.createPlayer('')); // 此处空字符串必填
audio.src = '';
audio.volume = 1;
audio.startTime = 0;
......@@ -6224,7 +6337,8 @@ var serviceContext = (function (vue) {
}
const VD_SYNC = 'vdSync';
const ON_WEBVIEW_READY = 'onWebviewReady';
const ON_WEBVIEW_READY = 'onWebviewReady';
const INVOKE_API = 'invokeApi';
const ACTION_TYPE_PAGE_CREATE = 1;
const ACTION_TYPE_PAGE_CREATED = 2;
......@@ -6580,7 +6694,11 @@ var serviceContext = (function (vue) {
// 非纯原生
subscribe(ON_WEBVIEW_READY, subscribeWebviewReady);
subscribe(VD_SYNC, onVdSync);
subscribe(INVOKE_API, onInvokeApi);
}
}
function onInvokeApi({ data: { method, args }, }) {
uni[method] && uni[method](args);
}
let appCtx;
......@@ -7450,11 +7568,15 @@ var serviceContext = (function (vue) {
}
function initPageOptions({ meta }) {
const statusbarHeight = getStatusbarHeight();
const { platform, pixelRatio, windowWidth } = getBaseSystemInfo();
return {
css: true,
route: meta.route,
version: 1,
locale: '',
platform,
pixelRatio,
windowWidth,
disableScroll: meta.disableScroll === true,
onPageScroll: false,
onPageReachBottom: false,
......@@ -7699,6 +7821,7 @@ var serviceContext = (function (vue) {
onSocketError: onSocketError,
onSocketMessage: onSocketMessage,
onSocketClose: onSocketClose,
uploadFile: uploadFile,
createInnerAudioContext: createInnerAudioContext,
getBackgroundAudioManager: getBackgroundAudioManager,
getLocation: getLocation,
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -18,6 +18,9 @@ export interface PageNodeOptions {
route: string
version: number
locale: string
platform: string
pixelRatio: number
windowWidth: number
disableScroll: boolean
onPageScroll: boolean
onPageReachBottom: boolean
......
export const VD_SYNC = 'vdSync'
export const ON_WEBVIEW_READY = 'onWebviewReady'
export const INVOKE_API = 'invokeApi'
......@@ -8,14 +8,7 @@ import {
SelectorQueryRequest,
} from '@dcloudio/uni-api'
export function getBaseSystemInfo() {
// TODO
return {
platform: '',
pixelRatio: 1,
windowWidth: 750,
}
}
export { getBaseSystemInfo } from '../service/api/base/getBaseSystemInfo'
export { getRealPath } from './getRealPath'
export function operateVideoPlayer(
videoId: string,
......
/**
* 简易版systemInfo,主要为upx2px,i18n服务
* @returns
*/
export function getBaseSystemInfo() {
// @ts-expect-error view 层
if (typeof __SYSTEM_INFO__ !== 'undefined') {
return (window as any).__SYSTEM_INFO__
}
const { resolutionWidth } = plus.screen.getCurrentSize()
return {
platform: (plus.os.name || '').toLowerCase(),
pixelRatio: plus.screen.scale!,
windowWidth: Math.round(resolutionWidth),
}
}
import { ON_WEBVIEW_READY, VD_SYNC } from '../../../../constants'
import { INVOKE_API, ON_WEBVIEW_READY, VD_SYNC } from '../../../../constants'
import { onVdSync } from '../../dom'
import { onPlusMessage } from '../initGlobalEvent'
import { subscribeWebviewReady } from './webviewReady'
......@@ -17,5 +17,14 @@ export function initSubscribeHandlers() {
// 非纯原生
subscribe(ON_WEBVIEW_READY, subscribeWebviewReady)
subscribe(VD_SYNC, onVdSync)
subscribe(INVOKE_API, onInvokeApi)
}
}
function onInvokeApi({
data: { method, args },
}: {
data: { method: UniApp.OpenType; args: any }
}) {
uni[method] && uni[method](args)
}
......@@ -15,6 +15,7 @@ import { PageNodeOptions } from '../../../PageAction'
import { getStatusbarHeight } from '../../../helpers/statusBar'
import tabBar from '../app/tabBar'
import { addCurrentPage } from './getCurrentPages'
import { getBaseSystemInfo } from '../../api/base/getBaseSystemInfo'
interface RegisterPageOptions {
url: string
......@@ -89,11 +90,15 @@ export function registerPage({
function initPageOptions({ meta }: UniApp.UniRoute): PageNodeOptions {
const statusbarHeight = getStatusbarHeight()
const { platform, pixelRatio, windowWidth } = getBaseSystemInfo()
return {
css: true,
route: meta.route,
version: 1,
locale: '',
platform,
pixelRatio,
windowWidth,
disableScroll: meta.disableScroll === true,
onPageScroll: false,
onPageReachBottom: false,
......
export { upx2px } from '@dcloudio/uni-api'
export * from './route'
import { INVOKE_API } from '../../constants'
function invokeApi(method: string, args: Record<string, any> = {}) {
UniViewJSBridge.publishHandler(INVOKE_API, {
data: {
method,
args,
},
options: {
timestamp: Date.now(),
},
})
}
export function navigateTo(args: Record<string, any>) {
invokeApi('navigateTo', args)
}
export function navigateBack(args: Record<string, any>) {
invokeApi('navigateBack', args)
}
export function reLaunch(args: Record<string, any>) {
invokeApi('reLaunch', args)
}
export function redirectTo(args: Record<string, any>) {
invokeApi('redirectTo', args)
}
export function switchTab(args: Record<string, any>) {
invokeApi('switchTab', args)
}
import { defineBuiltInComponent } from '@dcloudio/uni-components'
export default /*#__PURE__*/ defineBuiltInComponent({
name: 'Ad',
})
import { defineBuiltInComponent } from '@dcloudio/uni-components'
export default /*#__PURE__*/ defineBuiltInComponent({
name: 'Map',
})
import { defineBuiltInComponent } from '@dcloudio/uni-components'
export default /*#__PURE__*/ defineBuiltInComponent({
name: 'Picker',
})
import { defineBuiltInComponent } from '@dcloudio/uni-components'
export default /*#__PURE__*/ defineBuiltInComponent({
name: 'WebView',
})
import Ad from '../../../components/ad'
import { UniComponent } from './UniComponent'
export class UniAd extends UniComponent {
constructor(id: number) {
super(id, 'uni-ad', Ad)
}
}
import '@dcloudio/uni-components/style/audio.css'
import { Audio } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniAudio extends UniComponent {
constructor(id: number) {
super(id, 'uni-audio', Audio)
}
}
import { UniNode } from '../elements/UniNode'
export class UniCamera extends UniNode {
constructor(id: number) {
super(id, 'uni-camera')
}
}
import '@dcloudio/uni-components/style/canvas.css'
import { Canvas } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniCanvas extends UniComponent {
constructor(id: number) {
super(id, 'uni-canvas', Canvas)
}
}
import '@dcloudio/uni-components/style/checkbox.css'
import { Checkbox } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniCheckbox extends UniComponent {
constructor(id: number) {
super(id, 'uni-checkbox', Checkbox)
}
}
import '@dcloudio/uni-components/style/checkbox-group.css'
import { CheckboxGroup } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniCheckboxGroup extends UniComponent {
constructor(id: number) {
super(id, 'uni-checkbox-group', CheckboxGroup)
}
}
import CoverImage from '../../../components/cover-image'
import { UniComponent } from './UniComponent'
export class UniCoverImage extends UniComponent {
constructor(id: number) {
super(id, 'uni-cover-image', CoverImage)
}
}
import CoverView from '../../../components/cover-view'
import { UniComponent } from './UniComponent'
export class UniCoverView extends UniComponent {
constructor(id: number) {
super(id, 'uni-cover-view', CoverView)
}
}
import '@dcloudio/uni-components/style/editor.css'
import { Editor } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniEditor extends UniComponent {
constructor(id: number) {
super(id, 'uni-editor', Editor)
}
}
import '@dcloudio/uni-components/style/form.css'
import { Form } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniForm extends UniComponent {
constructor(id: number) {
super(id, 'uni-form', Form)
}
}
import { UniNode } from '../elements/UniNode'
export class UniFunctionalPageNavigator extends UniNode {
constructor(id: number) {
super(id, 'uni-functional-page-navigator')
}
}
import '@dcloudio/uni-components/style/icon.css'
import { Icon } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniIcon extends UniComponent {
constructor(id: number) {
super(id, 'uni-icon', Icon)
}
}
import '@dcloudio/uni-components/style/image.css'
import { Image } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniImage extends UniComponent {
constructor(id: number) {
super(id, 'uni-image', Image)
}
}
import '@dcloudio/uni-components/style/input.css'
import { Input } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniInput extends UniComponent {
constructor(id: number) {
super(id, 'uni-input', Input)
}
}
import '@dcloudio/uni-components/style/label.css'
import { Label } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniLabel extends UniComponent {
constructor(id: number) {
super(id, 'uni-label', Label)
}
}
import { UniNode } from '../elements/UniNode'
export class UniLivePlayer extends UniNode {
constructor(id: number) {
super(id, 'uni-live-player')
}
}
import { UniNode } from '../elements/UniNode'
export class UniLivePusher extends UniNode {
constructor(id: number) {
super(id, 'uni-live-pusher')
}
}
import Map from '../../../components/map'
import { UniComponent } from './UniComponent'
export class UniMap extends UniComponent {
constructor(id: number) {
super(id, 'uni-map', Map)
}
}
import '@dcloudio/uni-components/style/movable-area.css'
import { MovableArea } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniMovableArea extends UniComponent {
constructor(id: number) {
super(id, 'uni-movable-area', MovableArea)
}
}
import '@dcloudio/uni-components/style/movable-view.css'
import { MovableView } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniMovableView extends UniComponent {
constructor(id: number) {
super(id, 'uni-movable-view', MovableView)
}
}
import '@dcloudio/uni-components/style/navigator.css'
import { Navigator } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniNavigator extends UniComponent {
constructor(id: number) {
super(id, 'uni-navigator', Navigator)
}
}
import { UniNode } from '../elements/UniNode'
export class UniOfficialAccount extends UniNode {
constructor(id: number) {
super(id, 'uni-official-account')
}
}
import { UniNode } from '../elements/UniNode'
export class UniOpenData extends UniNode {
constructor(id: number) {
super(id, 'uni-open-data')
}
}
import Picker from '../../../components/picker'
import { UniComponent } from './UniComponent'
export class UniPicker extends UniComponent {
constructor(id: number) {
super(id, 'uni-picker', Picker)
}
}
import '@dcloudio/uni-components/style/picker-view.css'
import { PickerView } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniPickerView extends UniComponent {
constructor(id: number) {
super(id, 'uni-picker-view', PickerView)
}
}
import '@dcloudio/uni-components/style/picker-view-column.css'
import { PickerViewColumn } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniPickerViewColumn extends UniComponent {
constructor(id: number) {
super(id, 'uni-picker-view-column', PickerViewColumn)
}
}
import '@dcloudio/uni-components/style/progress.css'
import { Progress } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniProgress extends UniComponent {
constructor(id: number) {
super(id, 'uni-progress', Progress)
}
}
import '@dcloudio/uni-components/style/radio.css'
import { Radio } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniRadio extends UniComponent {
constructor(id: number) {
super(id, 'uni-radio', Radio)
}
}
import '@dcloudio/uni-components/style/radio-group.css'
import { RadioGroup } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniRadioGroup extends UniComponent {
constructor(id: number) {
super(id, 'uni-radio-group', RadioGroup)
}
}
import '@dcloudio/uni-components/style/rich-text.css'
import { RichText } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniRichText extends UniComponent {
constructor(id: number) {
super(id, 'uni-rich-text', RichText)
}
}
import '@dcloudio/uni-components/style/scroll-view.css'
import { ScrollView } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniScrollView extends UniComponent {
constructor(id: number) {
super(id, 'uni-scroll-view', ScrollView)
}
}
import '@dcloudio/uni-components/style/slider.css'
import { Slider } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniSlider extends UniComponent {
constructor(id: number) {
super(id, 'uni-slider', Slider)
}
}
import '@dcloudio/uni-components/style/swiper.css'
import { Swiper } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniSwiper extends UniComponent {
constructor(id: number) {
super(id, 'uni-swiper', Swiper)
}
}
import '@dcloudio/uni-components/style/swiper-item.css'
import { SwiperItem } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniSwiperItem extends UniComponent {
constructor(id: number) {
super(id, 'uni-swiper-item', SwiperItem)
}
}
import '@dcloudio/uni-components/style/switch.css'
import { Switch } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniSwitch extends UniComponent {
constructor(id: number) {
super(id, 'uni-switch', Switch)
}
}
import '@dcloudio/uni-components/style/text.css'
import { Text } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniText extends UniComponent {
constructor(id: number) {
super(id, 'uni-text', Text)
}
}
import '@dcloudio/uni-components/style/textarea.css'
import { Textarea } from '@dcloudio/uni-components'
import { UniComponent } from './UniComponent'
export class UniTextarea extends UniComponent {
constructor(id: number) {
super(id, 'uni-textarea', Textarea)
}
}
import '../../../../../style/video.css'
import Video from '../../../components/video'
import { UniComponent } from './UniComponent'
export class UniVideo extends UniComponent {
constructor(id: number) {
super(id, 'uni-video', Video)
}
}
import WebView from '../../../components/web-view'
import { UniComponent } from './UniComponent'
export class UniWebView extends UniComponent {
constructor(id: number) {
super(id, 'uni-web-view', WebView)
}
}
import { defineComponent, h } from 'vue'
import { UniComment } from '../elements/UniComment'
import { UniText } from '../elements/UniText'
import { UniTextNode } from '../elements/UniTextNode'
import { UniViewElement } from '../elements/UniViewElement'
import { UniAd } from './UniAd'
import { UniAudio } from './UniAudio'
import { UniButton } from './UniButton'
import { UniCamera } from './UniCamera'
import { UniCanvas } from './UniCanvas'
import { UniCheckbox } from './UniCheckbox'
import { UniCheckboxGroup } from './UniCheckboxGroup'
import { UniCoverImage } from './UniCoverImage'
import { UniCoverView } from './UniCoverView'
import { UniEditor } from './UniEditor'
import { UniForm } from './UniForm'
import { UniFunctionalPageNavigator } from './UniFunctionalPageNavigator'
import { UniIcon } from './UniIcon'
import { UniImage } from './UniImage'
import { UniInput } from './UniInput'
import { UniLabel } from './UniLabel'
import { UniLivePlayer } from './UniLivePlayer'
import { UniLivePusher } from './UniLivePusher'
import { UniMap } from './UniMap'
import { UniMovableArea } from './UniMovableArea'
import { UniMovableView } from './UniMovableView'
import { UniNavigator } from './UniNavigator'
import { UniOfficialAccount } from './UniOfficialAccount'
import { UniOpenData } from './UniOpenData'
import { UniPicker } from './UniPicker'
import { UniPickerView } from './UniPickerView'
import { UniPickerViewColumn } from './UniPickerViewColumn'
import { UniProgress } from './UniProgress'
import { UniRadio } from './UniRadio'
import { UniRadioGroup } from './UniRadioGroup'
import { UniRichText } from './UniRichText'
import { UniScrollView } from './UniScrollView'
import { UniSlider } from './UniSlider'
import { UniSwiper } from './UniSwiper'
import { UniSwiperItem } from './UniSwiperItem'
import { UniSwitch } from './UniSwitch'
import { UniText } from './UniText'
import { UniTextarea } from './UniTextarea'
import { UniVideo } from './UniVideo'
import { UniWebView } from './UniWebView'
export interface UniCustomElement extends Element {
__id: number
......@@ -12,13 +51,48 @@ export interface UniCustomElement extends Element {
const BuiltInComponents = [
,
UniViewElement,
,
,
UniImage,
UniText,
UniTextNode,
UniComment,
,
,
UniNavigator,
UniForm,
UniButton,
UniInput,
UniLabel,
UniRadio,
UniCheckbox,
UniCheckboxGroup,
UniAd,
UniAudio,
UniCamera,
UniCanvas,
UniCoverImage,
UniCoverView,
UniEditor,
UniFunctionalPageNavigator,
UniIcon,
UniRadioGroup,
UniLivePlayer,
UniLivePusher,
UniMap,
UniMovableArea,
UniMovableView,
UniOfficialAccount,
UniOpenData,
UniPicker,
UniPickerView,
UniPickerViewColumn,
UniProgress,
UniRichText,
UniScrollView,
UniSlider,
UniSwiper,
UniSwiperItem,
UniSwitch,
UniTextarea,
UniVideo,
UniWebView,
]
export type WrapperComponent = ReturnType<typeof createWrapper>
......
import { UniNode } from './UniNode'
export class UniText extends UniNode {
export class UniTextNode extends UniNode {
constructor(id: number) {
super(id, '#text')
this.$ = document.createTextNode('')
......
import { rpx2px } from '@dcloudio/uni-core'
import { camelize, capitalize, hyphenate, isArray, isString } from '@vue/shared'
export function patchStyle(el: Element, value: string | Record<string, any>) {
......@@ -7,7 +8,7 @@ export function patchStyle(el: Element, value: string | Record<string, any>) {
el.removeAttribute('style')
} else {
// TODO display
style.cssText = value
style.cssText = rpx2px(value, true)
}
} else {
for (const key in value) {
......@@ -26,6 +27,7 @@ function setStyle(
if (isArray(val)) {
val.forEach((v) => setStyle(style, name, v))
} else {
val = rpx2px(val, true)
if (name.startsWith('--')) {
// custom property definition
style.setProperty(name, val)
......
......@@ -35,6 +35,9 @@ export function onPageCreated() {}
export function onPageCreate({
css,
route,
platform,
pixelRatio,
windowWidth,
disableScroll,
onPageScroll,
onPageReachBottom,
......@@ -43,6 +46,7 @@ export function onPageCreate({
windowTop,
windowBottom,
}: PageCreateData) {
initSystemInfo(platform, pixelRatio, windowWidth)
// 初始化页面容器元素
initPageElement()
......@@ -63,6 +67,18 @@ export function onPageCreate({
}
}
function initSystemInfo(
platform: string,
pixelRatio: number,
windowWidth: number
) {
;(window as any).__SYSTEM_INFO__ = {
platform,
pixelRatio,
windowWidth,
}
}
function initPageElement() {
createElement(0, 'div').$ = document.getElementById('app')!
}
......
......@@ -4,7 +4,10 @@ import '@dcloudio/uni-h5/style/framework/nvue.css'
import { ON_WEBVIEW_READY } from '../constants'
import { UniViewJSBridge } from './bridge'
import { initView } from './framework'
import * as uni from './api'
;(window as any).uni = uni
;(window as any).UniViewJSBridge = UniViewJSBridge
;(window as any).rpx2px = uni.upx2px
function onWebviewReady() {
initView()
......
......@@ -11,9 +11,30 @@ function uniCopyPlugin() {
return uni_cli_shared_1.uniViteCopyPlugin({
targets: [
{
src: slash_1.default(path_1.default.resolve(__dirname, '../../lib/template/*')),
src: slash_1.default(path_1.default.resolve(__dirname, '../../lib/template/*.js')),
dest: process.env.UNI_OUTPUT_DIR,
},
{
src: slash_1.default(path_1.default.resolve(__dirname, '../../lib/template/*.png')),
dest: process.env.UNI_OUTPUT_DIR,
},
{
src: slash_1.default(path_1.default.resolve(__dirname, '../../lib/template/__uniappview.html')),
dest: process.env.UNI_OUTPUT_DIR,
transform(content) {
const { globalStyle } = uni_cli_shared_1.parsePagesJsonOnce(process.env.UNI_INPUT_DIR, process.env.UNI_PLATFORM);
const __uniConfig = {
globalStyle: {
rpxCalcMaxDeviceWidth: globalStyle.rpxCalcMaxDeviceWidth,
rpxCalcBaseDeviceWidth: globalStyle
.rpxCalcBaseDeviceWidth,
},
};
return content
.toString()
.replace('/*__uniConfig*/', `var __uniConfig = ${JSON.stringify(__uniConfig)}`);
},
},
{
src: slash_1.default(require.resolve('@dcloudio/uni-app-plus/dist/uni-app-view.umd.js')),
dest: process.env.UNI_OUTPUT_DIR,
......
......@@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>View</title>
<link rel="stylesheet" href="app.css" />
<script>/*__uniConfig*/</script>
</head>
<body>
<div id="app"></div>
......
import path from 'path'
import slash from 'slash'
import { uniViteCopyPlugin } from '@dcloudio/uni-cli-shared'
import { parsePagesJsonOnce, uniViteCopyPlugin } from '@dcloudio/uni-cli-shared'
export function uniCopyPlugin() {
return uniViteCopyPlugin({
targets: [
{
src: slash(path.resolve(__dirname, '../../lib/template/*')),
src: slash(path.resolve(__dirname, '../../lib/template/*.js')),
dest: process.env.UNI_OUTPUT_DIR,
},
{
src: slash(path.resolve(__dirname, '../../lib/template/*.png')),
dest: process.env.UNI_OUTPUT_DIR,
},
{
src: slash(
path.resolve(__dirname, '../../lib/template/__uniappview.html')
),
dest: process.env.UNI_OUTPUT_DIR,
transform(content) {
const { globalStyle } = parsePagesJsonOnce(
process.env.UNI_INPUT_DIR,
process.env.UNI_PLATFORM
)
const __uniConfig = {
globalStyle: {
rpxCalcMaxDeviceWidth: (globalStyle as any).rpxCalcMaxDeviceWidth,
rpxCalcBaseDeviceWidth: (globalStyle as any)
.rpxCalcBaseDeviceWidth,
},
}
return content
.toString()
.replace(
'/*__uniConfig*/',
`var __uniConfig = ${JSON.stringify(__uniConfig)}`
)
},
},
{
src: slash(
require.resolve('@dcloudio/uni-app-plus/dist/uni-app-view.umd.js')
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -3,6 +3,7 @@ export function PolySymbol(name: string) {
}
function hasRpx(str: string) {
str = str + ''
return str.indexOf('rpx') !== -1 || str.indexOf('upx') !== -1
}
......
......@@ -11,6 +11,7 @@ const setup_1 = require("./plugins/setup");
const ssr_1 = require("./plugins/ssr");
const utils_1 = require("./utils");
const handleHotUpdate_1 = require("./handleHotUpdate");
const transformIndexHtml_1 = require("./transformIndexHtml");
function initLogger({ logger, command }) {
if (command !== 'serve') {
return;
......@@ -43,6 +44,7 @@ const UniH5Plugin = {
initLogger(config);
},
handleHotUpdate: handleHotUpdate_1.createHandleHotUpdate(),
transformIndexHtml: transformIndexHtml_1.createTransformIndexHtml(),
};
exports.default = [
cssScoped_1.uniCssScopedPlugin(),
......
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createTransformIndexHtml = void 0;
const dist_1 = require("../../../uni-cli-shared/dist");
function createTransformIndexHtml() {
return function (html) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const manifestJson = dist_1.parseManifestJsonOnce(process.env.UNI_INPUT_DIR);
const title = ((_a = manifestJson.h5) === null || _a === void 0 ? void 0 : _a.title) || manifestJson.name || '';
return html.replace(/<title>(.*?)<\/title>/, `<title>${title}</title>`);
});
};
}
exports.createTransformIndexHtml = createTransformIndexHtml;
......@@ -12,6 +12,7 @@ import { uniSSRPlugin } from './plugins/ssr'
import { createDefine } from './utils'
import { createHandleHotUpdate } from './handleHotUpdate'
import { createTransformIndexHtml } from './transformIndexHtml'
function initLogger({ logger, command }: ResolvedConfig) {
if (command !== 'serve') {
......@@ -46,6 +47,7 @@ const UniH5Plugin: UniVitePlugin = {
initLogger(config)
},
handleHotUpdate: createHandleHotUpdate(),
transformIndexHtml: createTransformIndexHtml(),
}
export default [
......
import { Plugin } from 'vite'
import { VitePluginUniResolvedOptions } from '..'
import { parseManifestJsonOnce } from '../../../uni-cli-shared/dist'
export function createTransformIndexHtml({
inputDir,
}: VitePluginUniResolvedOptions): Plugin['transformIndexHtml'] {
export function createTransformIndexHtml(): Plugin['transformIndexHtml'] {
return async function (html) {
const manifestJson = parseManifestJsonOnce(inputDir)
const manifestJson = parseManifestJsonOnce(process.env.UNI_INPUT_DIR)
const title = manifestJson.h5?.title || manifestJson.name || ''
return html.replace(/<title>(.*?)<\/title>/, `<title>${title}</title>`)
}
......
......@@ -797,6 +797,7 @@ function PolySymbol(name) {
return Symbol(process.env.NODE_ENV !== "production" ? "[uni-app]: " + name : name);
}
function hasRpx(str) {
str = str + "";
return str.indexOf("rpx") !== -1 || str.indexOf("upx") !== -1;
}
function rpx2px(str, replace = false) {
......@@ -16754,7 +16755,7 @@ const sendSocketMessage = /* @__PURE__ */ defineAsyncApi(API_SEND_SOCKET_MESSAGE
const closeSocket = /* @__PURE__ */ defineAsyncApi(API_CLOSE_SOCKET, (options, { resolve, reject }) => {
const socketTask = socketTasks[0];
if (socketTask) {
callSocketTask(socketTask, "send", options, resolve, reject);
callSocketTask(socketTask, "close", options, resolve, reject);
} else {
reject("WebSocket is not connected");
}
......
......@@ -10,7 +10,6 @@ import { createConfig } from './config'
import { createConfigResolved } from './configResolved'
import { createConfigureServer } from './configureServer'
import { initExtraPlugins } from './utils'
import { createTransformIndexHtml } from './transformIndexHtml'
const debugUni = debug('vite:uni:plugin')
......@@ -82,7 +81,6 @@ export default function uniPlugin(
config: createConfig(options, uniPlugins),
configResolved: createConfigResolved(options),
configureServer: createConfigureServer(options),
transformIndexHtml: createTransformIndexHtml(options),
})
plugins.push(...uniPlugins)
return plugins
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册