gpt4 book ai didi

javascript - 无法从 IOS 中的 ionic 1 应用程序页面复制

标记内的文本

转载 作者:行者123 更新时间:2023-11-28 04:03:18 25 4
gpt4 key购买 nike

我为 IOS 和 Android 平台创建了一个 ionic-1 应用程序。在其中一个 View 中,我显示了一些手机号码,这些号码位于 <p> 中。标签。当用户单击并按住该数字进行选择时,它应该复制该数字。在安卓上运行良好,但在 IOS 上不行。我使用过一些解决方案,例如 user-select: text;user-select: auto;我怎样才能在IOS中做到这一点?

最佳答案

尝试这个解决方案

angular.module('ionicApp', ['ionic'])

.controller('MyCtrl', function($scope) {
stop_browser_behavior: false

self.touchStart = function(e) {
self.startCoordinates = getPointerCoordinates(e);

if ( ionic.tap.ignoreScrollStart(e) ) {
return;
}

if( ionic.tap.containsOrIsTextInput(e.target) ) {
// do not start if the target is a text input
// if there is a touchmove on this input, then we can start the scroll
self.__hasStarted = false;
return;
}

self.__isSelectable = true;
self.__enableScrollY = true;
self.__hasStarted = true;
self.doTouchStart(e.touches, e.timeStamp);
// e.preventDefault();
};
});
body {
cursor: url('https://ionicframework.com/img/finger.png'), auto;
}

ion-content{
overflow-scroll: true;
}

.scroll-content {
-webkit-user-select: auto !important;
-moz-user-select: auto !important;
-ms-user-select: auto !important;
user-select: auto !important;}

.selectable {
-webkit-user-select: auto;
}
<html ng-app="ionicApp">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">

<title>Ionic Template</title>

<link href="https://code.ionicframework.com/1.0.0-beta.4/css/ionic.css" rel="stylesheet">
<script src="https://code.ionicframework.com/1.0.0-beta.4/js/ionic.bundle.js"></script>
</head>
<body ng-controller="MyCtrl">

<ion-header-bar class="bar-positive">

<h1 class="title">{{myTitle}}</h1>

</ion-header-bar>

<ion-content padding="true" overflow-scroll='true'>
<h2>Content</h2>
<div class='selectable'>

Text that users should be able to select and copy.
</div>
</ion-content>


</body>
</html>

关于javascript - 无法从 IOS 中的 ionic 1 应用程序页面复制 <p> 标记内的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46907962/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com